public async Task ReturnLectorDetailModel_WhenLectorExists() { var handler = new GetLectorDetailQueryHandler(Context); var result = await handler.Handle(new GetLectorDetailQuery { Id = 1 }, CancellationToken.None); Assert.IsInstanceOf(typeof(LectorDetailModel), result); }
public async Task ThrowNotFoundException_WhenLectorIsNotExists() { var notExistingLectorId = 1000; var handler = new GetLectorDetailQueryHandler(Context); var exception = Assert.ThrowsAsync <NotFoundException>(async() => await handler.Handle(new GetLectorDetailQuery { Id = notExistingLectorId }, CancellationToken.None)); Assert.AreEqual(exception.Message, ExceptionMessagesBuilderHelper.GetNotFoundExceptionMessage(nameof(Lector), notExistingLectorId)); }