예제 #1
0
        public async Task Handle_GivenInvalidId_ThrowsException()
        {
            var command = new UpdateConsultationCommand
            {
                Id    = 99,
                Plans = "rv daily",
            };

            var handler = new UpdateConsultationCommand.UpdateConsultationCommandHandler(Context, _mapper);

            Func <Task> action = () => handler.Handle(command, CancellationToken.None);

            await action.Should().ThrowExactlyAsync <NotFoundException>();
        }
예제 #2
0
        public async Task Handle_GivenValidId_ShouldUpdatePersistedTodoList()
        {
            var command = new UpdateConsultationCommand
            {
                Id    = 2,
                Plans = "rv one more time this week"
            };

            var handler = new UpdateConsultationCommand.UpdateConsultationCommandHandler(Context, _mapper);

            await handler.Handle(command, CancellationToken.None);

            var entity = Context.Consultations.Find(command.Id);

            entity.Should().NotBeNull();
            entity.Plans.Should().Be(command.Plans);
        }