PageRenderTime 21ms CodeModel.GetById 15ms app.highlight 4ms RepoModel.GetById 1ms 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
 1using Bifrost.Commands;
 2using Machine.Specifications;
 3
 4namespace Bifrost.Specs.Commands.for_CommandHandlerInvoker
 5{
 6	[Subject(Subjects.handling_commands)]
 7	public class when_handling_with_manually_registered_command_handlers : given.a_command_handler_invoker_with_no_command_handlers
 8	{
 9	    static CommandHandler handler;
10		static bool result;
11
12	    Establish context = () =>
13	                            {
14                                    handler = new CommandHandler();
15	                                service_locator_mock.Setup(s => s.GetInstance(typeof (CommandHandler))).Returns(
16	                                    handler);
17
18	                                invoker.Register(typeof (CommandHandler));
19	                            };
20
21		Because of = () =>
22						{
23							var command = new Command();
24							result = invoker.TryHandle(command);
25						};
26
27		It should_return_true_when_trying_to_handle = () => result.ShouldBeTrue();
28	}
29}