public async Task TestRegistrationV2() { SearchCourses filter = new SearchCourses(); HttpClient httpClient = new HttpClient(); RegistrationController registrationController = new RegistrationController(_unitOfWork); httpClient.DefaultRequestHeaders.Accept .Add(new MediaTypeWithQualityHeaderValue("application/json")); filter.isTest = true; filter.CourseName = ""; filter.CourseNumber = ""; filter.CreditHours = ""; filter.Department = ""; var registrationsFromDatabase = _context.Registration.Where(x => x.StudentID == 20); _context.Registration.RemoveRange(registrationsFromDatabase); _context.SaveChanges(); var coursesFromController = registrationController.GetCourses(filter, 20); int controllerCourseCount = coursesFromController.Count; int databaseCourseCount = _context.Course.Count(); Assert.AreEqual(controllerCourseCount, databaseCourseCount); foreach (var course in coursesFromController) { registrationController.AddOrRemoveRegistration(course.ID, true, 20); } int registrationCountFromDatabase = _context.Registration.Where(x => x.StudentID == 20).Count(); int registrationCountFromController = registrationController.GetCourses(filter, 20).Count(); Assert.AreEqual(databaseCourseCount, registrationCountFromDatabase); Assert.AreEqual(controllerCourseCount, registrationCountFromDatabase); Assert.AreEqual(registrationCountFromController, registrationCountFromDatabase); registrationsFromDatabase = _context.Registration.Where(x => x.StudentID == 20); _context.Registration.RemoveRange(registrationsFromDatabase); _context.SaveChanges(); }