コード例 #1
0
        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();
        }
コード例 #2
0
        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();
        }