main
 1using System.Collections.Generic;
 2using jive;
 3using Machine.Specifications;
 4
 5namespace specs.unit
 6{
 7  [Subject(typeof (DefaultRegistry<int>))]
 8  public class when_retrieving_all_the_items_from_the_default_repository
 9  {
10    It should_leverage_the_resolver_to_retrieve_all_the_implementations =
11      () => registry.Verify(r => r.get_all<int>());
12
13    It should_return_the_items_resolved_by_the_registry = () => result.should_contain(24);
14
15    Establish c = () =>
16    {
17      var items_to_return = new List<int> {24};
18      registry = Create.an<DependencyRegistry>();
19      registry.Setup(r => r.get_all<int>()).Returns(items_to_return);
20      sut = create_sut();
21    };
22
23    static Registry<int> create_sut()
24    {
25      return new DefaultRegistry<int>(registry.Object);
26    }
27
28    Because b = () =>
29    {
30      result = sut.all();
31    };
32
33    static Moq.Mock<DependencyRegistry> registry;
34    static IEnumerable<int> result;
35    static Registry<int> sut;
36  }
37}