public void CreateEvent_CallEventFactory( [Frozen] IEventFactory eventFactory, CreateEventCommand message, Event @event, CreateEventCommandHandler createEventCommandHandler) { //Information A.CallTo(() => eventFactory.Create(message.Event)).Returns(@event); //Act createEventCommandHandler.ExecuteAsync(message); //Test A.CallTo(() => eventFactory.Create(message.Event)).MustHaveHappened(); }
public void CreateEvent_SendICommandHandlerWithCreateRouteCommand( [Frozen] ICommandHandler <CreateRouteCommand> createRouteCommandHandler, [Frozen] IEventRepository eventRepository, [Frozen] IEventFactory eventFactory, CreateEventCommand message, Event @event, CreateEventCommandHandler createEventCommandHandler) { //Information A.CallTo(() => eventFactory.Create(message.Event)).Returns(@event); A.CallTo(() => eventRepository.Add(@event)); //Act createEventCommandHandler.ExecuteAsync(message); //Test A.CallTo(() => createRouteCommandHandler.ExecuteAsync(A <CreateRouteCommand> .Ignored)) .MustHaveHappened(); }