Beispiel #1
0
        public void Handle_GivenInvalidId_ThrowsException()
        {
            var command = new DeleteEmailLogCommand
            {
                Id = 99
            };

            var handler = new DeleteEmailLogCommand.DeleteEmailLogCommandHandler(Context);

            Should.ThrowAsync <NotFoundException>(() =>
                                                  handler.Handle(command, CancellationToken.None));
        }
Beispiel #2
0
        public async Task Handle_GivenValidId_ShouldRemovePersistedEmailLog()
        {
            var command = new DeleteEmailLogCommand
            {
                Id = 1
            };

            var handler = new DeleteEmailLogCommand.DeleteEmailLogCommandHandler(Context);

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

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

            entity.ShouldBeNull();
        }