PageRenderTime 28ms CodeModel.GetById 14ms app.highlight 8ms RepoModel.GetById 1ms app.codeStats 0ms

/Source/Bifrost.Specs/Execution/for_BindingConventionManager/when_initializing_with_two_conventions_and_one_type_and_first_convention_can_resolve.cs

#
C# | 36 lines | 30 code | 6 blank | 0 comment | 0 complexity | a645fe740ce033477f18bfb4b21e6e2f MD5 | raw file
 1using System;
 2using Bifrost.Execution;
 3using Machine.Specifications;
 4using Moq;
 5using It = Machine.Specifications.It;
 6
 7namespace Bifrost.Specs.Execution.for_BindingConventionManager
 8{
 9    public class when_initializing_with_two_conventions_and_one_type_and_first_convention_can_resolve : given.a_binding_convention_manager_with_one_type
10    {
11        static Mock<IBindingConvention> first_convention_mock;
12        static Type first_convention_type;
13
14        static FakeBindingConvention second_convention;
15        static Type second_convention_type;
16
17        Establish context = () =>
18                                {
19                                    first_convention_mock = new Mock<IBindingConvention>();
20                                    first_convention_type = first_convention_mock.Object.GetType();
21                                    manager.Add(first_convention_type);
22                                    container_mock.Setup(c => c.Get(first_convention_type)).Returns(first_convention_mock.Object);
23                                    first_convention_mock.Setup(c => c.CanResolve(service_type)).Returns(true);
24
25                                    second_convention = new FakeBindingConvention();
26                                    second_convention_type = typeof (FakeBindingConvention);
27                                    manager.Add(second_convention_type);
28                                    container_mock.Setup(c => c.Get(second_convention_type)).Returns(second_convention);
29                                    second_convention.CanResolveProperty = false;
30                                };
31
32        Because of = () => manager.Initialize();
33
34        It should_not_ask_if_it_can_resolve_on_second_convention = () => second_convention.ResolveCalled.ShouldBeFalse();
35    }
36}