public async Task ThrowNotFoundException_WhenSubjectIsNotExists() { var notExistingSubjectId = 1000; var handler = new GetSubjectQueryHandler(Context); var exception = Assert.ThrowsAsync <NotFoundException>(async() => await handler.Handle(new GetSubjectQuery { Id = notExistingSubjectId }, CancellationToken.None)); Assert.AreEqual(exception.Message, ExceptionMessagesBuilderHelper.GetNotFoundExceptionMessage(nameof(Subject), notExistingSubjectId)); }
public async Task ThrowNotFoundException_WhenGroupIsNotExists() { var request = new DeleteGroupCommand { Id = 100 }; var handler = new DeleteGroupCommandHandler(Context); var exception = Assert.ThrowsAsync <NotFoundException>(async() => await handler.Handle(request, CancellationToken.None)); Assert.AreEqual(exception.Message, ExceptionMessagesBuilderHelper.GetNotFoundExceptionMessage(nameof(Group), request.Id)); }
public async Task ThrowNotFoundException_WhenSubjectIsNotExists() { var request = new UpdateSubjectCommand { Id = 100, Name = "Test Subject Edited" }; var handler = new UpdateSubjectCommandHandler(Context); var exception = Assert.ThrowsAsync <NotFoundException>(async() => await handler.Handle(request, CancellationToken.None)); Assert.AreEqual(exception.Message, ExceptionMessagesBuilderHelper.GetNotFoundExceptionMessage(nameof(Subject), request.Id)); }
public async Task ThrowNotFoundException_WhenGroupIsNotExists() { var request = new UpdateGroupCommand { Id = 100, Name = "Test Group Edited", SpecialityId = 1, StudentsCount = 10, EducationalDegreeId = 1, Year = 1 }; var handler = new UpdateGroupCommandHandler(Context); var exception = Assert.ThrowsAsync <NotFoundException>(async() => await handler.Handle(request, CancellationToken.None)); Assert.AreEqual(exception.Message, ExceptionMessagesBuilderHelper.GetNotFoundExceptionMessage(nameof(Group), request.Id)); }
public async Task ThrowNotFoundException_WhenLectorIsNotExists() { var request = new UpdateLectorCommand { Id = 100, AcademicDegreeId = 1, AcademicRankId = 1, Email = "*****@*****.**", FirstName = "Name 1", LastName = "LastName 1", Patronymic = "Patronymic 1", PhoneNumber = "+0000000000" }; var handler = new UpdateLectorCommandHandler(Context); var exception = Assert.ThrowsAsync <NotFoundException>(async() => await handler.Handle(request, CancellationToken.None)); Assert.AreEqual(exception.Message, ExceptionMessagesBuilderHelper.GetNotFoundExceptionMessage(nameof(Lector), request.Id)); }