Add() 개인적인 메소드

private Add ( StudentModel studentModel ) : HttpResponseMessage
studentModel SchoolsSystem.DataTransferObjects.StudentModel
리턴 System.Net.Http.HttpResponseMessage
        public void AddValidStudent_ShouldBeAddedCorrectly()
        {
            var unitOfWork = Mock.Create<IUnitOfWork>();

            School school = new School() { Location = "Location", Name = "Name" };

            Student studentEntity = new Student()
            {
                FirstName = "Pesho",
                LastName = "Peshov",
                Age = 16,
                Grade = 10,
                School = school,
                Marks = new List<Mark>() { new Mark() { Subject = "math", Value = 6 } }
            };

            bool isItemAdded = false;
            Mock.Arrange(() => unitOfWork.SchoolsRepository.Get(Arg.IsAny<int>()))
                .Returns(school);

            Mock.Arrange(() => unitOfWork.StudentsRepository.Add(Arg.IsAny<Student>()))
                .DoInstead(() => isItemAdded = true)
                .Returns(studentEntity);

            var studentsController = new StudentsController(unitOfWork);
            SetupController(studentsController);

            StudentModel studentModel = new StudentModel()
            {
                FirstName = "Pesho",
                LastName = "Peshov",
                Age = 16,
                Grade = 10,
                School = new SchoolDetails() { Location = school.Location, Name = school.Name },
                Marks = new List<MarkModel>() { new MarkModel() { Subject = "math", Value = 6 } }
            };
            studentsController.Add(studentModel);

            Assert.IsTrue(isItemAdded);
        }
        public void AddStudentWithoutSchool_ShouldNotBeAdded()
        {
            var unitOfWork = Mock.Create<IUnitOfWork>();

            Student studentEntity = new Student()
            {
                FirstName = "Pesho",
                LastName = "Peshov",
                Age = 16,
                Grade = 10,
                Marks = new List<Mark>() { new Mark() { Subject = "math", Value = 6 } }
            };

            bool isItemAdded = false;
            Mock.Arrange(() => unitOfWork.StudentsRepository.Add(Arg.IsAny<Student>()))
                .DoInstead(() => isItemAdded = true)
                .Returns(studentEntity);

            var studentsController = new StudentsController(unitOfWork);
            SetupController(studentsController);

            StudentModel studentModel = new StudentModel()
            {
                FirstName = "Pesho",
                LastName = "Peshov",
                Age = 16,
                Grade = 10,
                Marks = new List<MarkModel>() { new MarkModel() { Subject = "math", Value = 6 } }
            };
            studentsController.Add(studentModel);

            Assert.IsFalse(isItemAdded);
        }