public async Task ThrowDeleteFailureException_WhenLessonWithGroupExists()
        {
            var request = new DeleteGroupCommand
            {
                Id = 2
            };

            var handler = new DeleteGroupCommandHandler(Context);

            var exception = Assert.ThrowsAsync <DeleteFailureException>(async() => await handler.Handle(request, CancellationToken.None));

            Assert.AreEqual(exception.Message, ExceptionMessagesBuilderHelper.GetDeleteFailureExceptionMessage(nameof(Group), request.Id, "There are lesson(s) with this group"));
        }
Esempio n. 2
0
        public async Task ThrowDeleteFailureException_WhenLessonWithLectorSubjectExists()
        {
            var request = new DeleteLectorSubjectCommand
            {
                Id = 2
            };

            var handler = new DeleteLectorSubjectCommandHandler(Context);

            var exception = Assert.ThrowsAsync <DeleteFailureException>(async() => await handler.Handle(request, CancellationToken.None));

            Assert.AreEqual(exception.Message, ExceptionMessagesBuilderHelper.GetDeleteFailureExceptionMessage(nameof(LectorSubject), request.Id, "This record is used in lesson(s)"));
        }
        public async Task ThrowDeleteFailureException_WhenGroupWithSpecialityExists()
        {
            var request = new DeleteSpecialityCommand
            {
                Id = 2
            };

            var handler = new DeleteSpecialityCommandHandler(Context);

            var exception = Assert.ThrowsAsync <DeleteFailureException>(async() => await handler.Handle(request, CancellationToken.None));

            Assert.AreEqual(exception.Message, ExceptionMessagesBuilderHelper.GetDeleteFailureExceptionMessage(nameof(Speciality), request.Id, "There are group(s) on this speciality"));
        }
        public async Task ThrowDeleteFailureException_WhenLectorSubjectWithLectorExists()
        {
            var request = new DeleteLectorCommand
            {
                Id = 2
            };

            var handler = new DeleteLectorCommandHandler(Context);

            var exception = Assert.ThrowsAsync <DeleteFailureException>(async() => await handler.Handle(request, CancellationToken.None));

            Assert.AreEqual(exception.Message, ExceptionMessagesBuilderHelper.GetDeleteFailureExceptionMessage(nameof(Lector), request.Id, "There are subject(s) assigned to this lector"));
        }