public async Task ReturnSpecialityDto_WhenSpecialityExists() { var handler = new GetSpecialityQueryHandler(Context); var result = await handler.Handle(new GetSpecialityQuery { Id = 1 }, CancellationToken.None); Assert.IsInstanceOf(typeof(SpecialityDto), result); }
public async Task ThrowNotFoundException_WhenSpecialityIsNotExists() { var notExistingSubjectId = 1000; var handler = new GetSpecialityQueryHandler(Context); var exception = Assert.ThrowsAsync <NotFoundException>(async() => await handler.Handle(new GetSpecialityQuery { Id = notExistingSubjectId }, CancellationToken.None)); Assert.AreEqual(exception.Message, ExceptionMessagesBuilderHelper.GetNotFoundExceptionMessage(nameof(Speciality), notExistingSubjectId)); }