PageRenderTime 44ms CodeModel.GetById 18ms RepoModel.GetById 0ms app.codeStats 0ms

/Source/Bifrost.Specs/Commands/for_CommandHandlerInvoker/when_handling_with_manually_registered_command_handlers.cs

#
C# | 29 lines | 24 code | 5 blank | 0 comment | 0 complexity | 1f1aa0710a446dfec34262d1614b08dc MD5 | raw file
Possible License(s): CC-BY-SA-3.0
  1. using Bifrost.Commands;
  2. using Machine.Specifications;
  3. namespace Bifrost.Specs.Commands.for_CommandHandlerInvoker
  4. {
  5. [Subject(Subjects.handling_commands)]
  6. public class when_handling_with_manually_registered_command_handlers : given.a_command_handler_invoker_with_no_command_handlers
  7. {
  8. static CommandHandler handler;
  9. static bool result;
  10. Establish context = () =>
  11. {
  12. handler = new CommandHandler();
  13. service_locator_mock.Setup(s => s.GetInstance(typeof (CommandHandler))).Returns(
  14. handler);
  15. invoker.Register(typeof (CommandHandler));
  16. };
  17. Because of = () =>
  18. {
  19. var command = new Command();
  20. result = invoker.TryHandle(command);
  21. };
  22. It should_return_true_when_trying_to_handle = () => result.ShouldBeTrue();
  23. }
  24. }