Esempio n. 1
0
        public void Find_ShouldReturnOneStudent()
        {
            Mark markEntity = new Mark()
            {
                Subject = "Math",
                Value   = 5
            };

            var marks = new List <Mark>();

            marks.Add(markEntity);

            Student studentEnitity = new Student()
            {
                FirstName = "Minko",
                LastName  = "Markov",
                School    = new School(),
                Grade     = 5,
                Marks     = marks
            };

            var fakeRepo = new FakeStudentRepository();

            fakeRepo.Add(studentEnitity);
            var controller = new StudentsController(fakeRepo);

            SetupController(controller);
            var students = controller.Find("Math", 5);

            Assert.IsNotNull(students);
            Assert.AreEqual(1, students.Count());
        }
Esempio n. 2
0
        public void Find_ShouldReturnCustomerByNameNotFoundResult()
        {
            var testStudentName = "Ali";
            var controller      = new StudentsController(studentDataProvider);
            var response        = controller.Find(testStudentName) as NotFoundResult;

            Assert.IsNotNull(response);
        }
Esempio n. 3
0
        public void Find_ShouldReturnStudentByNameOkResult()
        {
            string testStudentName = "AhmedHammad";
            var    controller      = new StudentsController(studentDataProvider);
            var    response        = controller.Find(testStudentName) as OkObjectResult;
            var    responseData    = response.Value as Student;

            Assert.IsNotNull(response.Value);
            Assert.AreEqual(responseData.Name, testStudentName);
        }