main
1using jive;
2using Machine.Specifications;
3
4namespace specs.unit.logging
5{
6 [Subject(typeof (Log))]
7 public class when_creating_a_logger_for_a_particular_type
8 {
9 It should_return_the_logger_created_for_that_type = () => result.should_be_equal_to(logger.Object);
10
11 Establish c =
12 () =>
13 {
14 var factory = Create.an<LogFactory>();
15 var registry = Create.an<DependencyRegistry>();
16 logger = Create.an<Logger>();
17 registry.Setup(x => x.get_a<LogFactory>()).Returns(factory.Object);
18 factory.Setup(x => x.create_for(typeof (string))).Returns(logger.Object);
19
20 Resolve.initialize_with(registry.Object);
21 };
22
23 Because b = () =>
24 {
25 result = Log.For("mo");
26 };
27
28 Cleanup a = () => Resolve.initialize_with(null);
29
30 static Logger result;
31 static Moq.Mock<Logger> logger;
32 }
33}