PageRenderTime 46ms CodeModel.GetById 22ms RepoModel.GetById 0ms 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
Possible License(s): CC-BY-SA-3.0
  1. using System;
  2. using Bifrost.Execution;
  3. using Machine.Specifications;
  4. using Moq;
  5. using It = Machine.Specifications.It;
  6. namespace Bifrost.Specs.Execution.for_BindingConventionManager
  7. {
  8. public class when_initializing_with_two_conventions_and_one_type_and_first_convention_can_resolve : given.a_binding_convention_manager_with_one_type
  9. {
  10. static Mock<IBindingConvention> first_convention_mock;
  11. static Type first_convention_type;
  12. static FakeBindingConvention second_convention;
  13. static Type second_convention_type;
  14. Establish context = () =>
  15. {
  16. first_convention_mock = new Mock<IBindingConvention>();
  17. first_convention_type = first_convention_mock.Object.GetType();
  18. manager.Add(first_convention_type);
  19. container_mock.Setup(c => c.Get(first_convention_type)).Returns(first_convention_mock.Object);
  20. first_convention_mock.Setup(c => c.CanResolve(service_type)).Returns(true);
  21. second_convention = new FakeBindingConvention();
  22. second_convention_type = typeof (FakeBindingConvention);
  23. manager.Add(second_convention_type);
  24. container_mock.Setup(c => c.Get(second_convention_type)).Returns(second_convention);
  25. second_convention.CanResolveProperty = false;
  26. };
  27. Because of = () => manager.Initialize();
  28. It should_not_ask_if_it_can_resolve_on_second_convention = () => second_convention.ResolveCalled.ShouldBeFalse();
  29. }
  30. }