main
 1using System.Collections.Generic;
 2using Gorilla.Commons.Infrastructure.Container;
 3using Gorilla.Commons.Infrastructure.Registries;
 4using gorilla.commons.utility;
 5
 6namespace tests.unit.commons.infrastructure
 7{
 8    [Concern(typeof (DefaultRegistry<int>))]
 9    public class when_retrieving_all_the_items_from_the_default_repository :
10        TestsFor<Registry<int>>
11    {
12        it should_leverage_the_resolver_to_retrieve_all_the_implementations =
13            () => registry.was_told_to(r => r.get_all<int>());
14
15        it should_return_the_items_resolved_by_the_registry = () => result.should_contain(24);
16
17        context c = () =>
18        {
19            var items_to_return = new List<int> {24};
20            registry = an<DependencyRegistry>();
21            registry.is_told_to(r => r.get_all<int>()).it_will_return(items_to_return);
22        };
23
24        public override Registry<int> create_sut()
25        {
26            return new DefaultRegistry<int>(registry);
27        }
28
29        because b = () =>
30        {
31            result = sut.all();
32        };
33
34        static DependencyRegistry registry;
35        static IEnumerable<int> result;
36    }
37}