public async Task ReturnLectorSubjectDto_WhenLectorSubjectExists() { var handler = new GetLectorSubjectQueryHandler(Context); var result = await handler.Handle(new GetLectorSubjectQuery { Id = 1 }, CancellationToken.None); Assert.IsInstanceOf(typeof(LectorSubjectDto), result); }
public async Task ThrowNotFoundException_WhenLectorSubjectIsNotExists() { var notExistingLectorSubjectId = 1000; var handler = new GetLectorSubjectQueryHandler(Context); var exception = Assert.ThrowsAsync <NotFoundException>(async() => await handler.Handle(new GetLectorSubjectQuery { Id = notExistingLectorSubjectId }, CancellationToken.None)); Assert.AreEqual(exception.Message, ExceptionMessagesBuilderHelper.GetNotFoundExceptionMessage(nameof(LectorSubject), notExistingLectorSubjectId)); }