main
 1using System;
 2using developwithpassion.bdd.contexts;
 3using developwithpassion.bdd.harnesses.mbunit;
 4using developwithpassion.bdddoc.core;
 5using gorilla.migrations.console.infrastructure;
 6
 7namespace tests.console.infrastructure
 8{
 9    public class SingletonSpecs
10    {
11        public abstract class concern : observations_for_a_sut_with_a_contract<Scope, Singleton> {}
12
13        [Concern(typeof (Singleton))]
14        public class when_retrieving_a_singleton_instance : concern
15        {
16            it should_return_the_same_instance_each_time = () =>
17            {
18                Func<TimeStamp> factory = () => new TimeStamp {time = DateTime.Now};
19                var first = controller.sut.apply_to(factory);
20                var second = controller.sut.apply_to(factory);
21                ReferenceEquals(first, second).should_be_true();
22            };
23        }
24
25        public class TimeStamp
26        {
27            public DateTime time { get; set; }
28        }
29    }
30}