public void TestGetAllStudentsGrades() { DbCourses dbCourses = new DbCourses(); dbCourses.Insert("Test Course", "Test Course"); ObjectResult result = (ObjectResult)gradesController.GetAllStudentsGrades("Test Course").Result; int? statusCode = result.StatusCode; Assert.Equal(200, statusCode); if (result.Value.GetType().Name == "String") { dbCourses.Delete("Test Course"); Assert.True(1 == 1, "That Course"); } else { List <AllStudentsInSingleCourse> actual = (List <AllStudentsInSingleCourse>)result.Value; ExpectedGrades expectedGrades = new ExpectedGrades(); List <AllStudentsInSingleCourse> expected = expectedGrades.AllStudentsInCourse("Test Course"); Assert.Equal(expected.Count, actual.Count); for (int i = 0; i < expected.Count; ++i) { Assert.Equal(expected[i].grade, actual[i].grade); } dbCourses.Delete("Test Course"); } }