public async Task Should_throw_delete_failure_exception()
        {
            // create course
            var createCourseCommand = new CreateCourseCommand()
            {
                Id          = Guid.NewGuid(),
                Code        = 1,
                Name        = "Course 1",
                Description = "Test"
            };

            var createCourseCommandHandler = new CreateCourseCommandHandler(this.autoMapper, this.context);
            var commandResult = await createCourseCommandHandler.Handle(createCourseCommand, CancellationToken.None);

            commandResult.ShouldBe(true);

            // Create student
            var createStudentCommand = new CreateStudentCommand()
            {
                Id          = Guid.NewGuid(),
                FirstName   = "Milos",
                LastName    = "Stojkovic",
                Address     = "Bata Noleta 31",
                City        = "Sokobanja",
                DateOfBirth = new DateTime(1991, 3, 18),
                State       = "Srbija",
                Gender      = 0
            };

            var createStudentCommandHandler = new CreateStudentCommandHandler(this.autoMapper, this.context);

            commandResult = await createStudentCommandHandler.Handle(createStudentCommand, CancellationToken.None);

            commandResult.ShouldBe(true);

            var createOrUpdateEnrollmentCommand = new CreateOrUpdateEnrollmentCommand()
            {
                Id         = createStudentCommand.Id,
                CourseCode = createCourseCommand.Code,
                Grade      = (int)Domain.Enumerations.Grade.Seven
            };

            var createOrUpdateEnrollmentCommandHandler = new CreateOrUpdateEnrollmentCommandHandler(this.context);

            commandResult = await createOrUpdateEnrollmentCommandHandler.Handle(createOrUpdateEnrollmentCommand, CancellationToken.None);

            commandResult.ShouldBe(true);

            var deleteStudentCommand = new DeleteStudentCommand()
            {
                Id = createStudentCommand.Id
            };

            var deleteStudentCommandHandler = new DeleteStudentCommandHandler(this.context);
            await Assert.ThrowsAsync <DeleteFailureException>(() => deleteStudentCommandHandler.Handle(deleteStudentCommand, CancellationToken.None));
        }
        public async Task Should_throw_not_found_exception()
        {
            var deleteStudentCommand = new DeleteStudentCommand()
            {
                Id = Guid.NewGuid()
            };

            var deleteStudentCommandHandler = new DeleteStudentCommandHandler(this.context);

            await Assert.ThrowsAsync <NotFoundException>(() => deleteStudentCommandHandler.Handle(deleteStudentCommand, CancellationToken.None));
        }
        public async Task Should_delete_student()
        {
            var deleteStudentCommand = new DeleteStudentCommand()
            {
                Id = Guid.NewGuid()
            };

            var deleteStudentCommandHandler = new DeleteStudentCommandHandler(this.context);

            var result = await deleteStudentCommandHandler.Handle(deleteStudentCommand, CancellationToken.None);

            result.ShouldBe(true);

            var dbStudent = await this.context.Student.FirstOrDefaultAsync(s => s.Id == deleteStudentCommand.Id);

            dbStudent.ShouldBeNull();
        }