コード例 #1
0
        public void TestGetStudentGrades()
        {
            ExpectedStudents     expectedStudents = new ExpectedStudents();
            string               studentSsn       = expectedStudents.GetStudents()[0].SSN;
            ExpectedGrades       expectedGrades   = new ExpectedGrades();
            List <StudentGrades> expected         = expectedGrades.ShowStudentGrades(studentSsn);
            ObjectResult         result           = (ObjectResult)gradesController.GetStudentGrades(studentSsn).Result;
            int?statusCode = result.StatusCode;

            Assert.Equal(200, statusCode);
            List <StudentGrades> actual = (List <StudentGrades>)result.Value;

            Assert.Equal(expected.Count, actual.Count);
            for (int i = 0; i < expected.Count; ++i)
            {
                Assert.True(expected[i].course == actual[i].course && expected[i].grade == actual[i].grade);
            }
        }