public void AddCourseTest() { // Arrange dynamic TestObj = new JObject(); TestObj.ID = 500; TestObj.Semester = MockFactory.SEMESTER_VALID; // Act: get list of courses before add var oldList = _mockFactory.GetMockData <Course>().Count; // list should not change since student already exists _service.AddCourse(TestObj); var wasTheCourseAdded = _service.GetCourseFunc(500, MockFactory.SEMESTER_VALID); var newList = _mockFactory.GetMockData <Course>().Count; // Assert: if the list got 1 bigger and that the course was found in mockdb Assert.AreEqual(oldList, newList - 1); Assert.IsNotNull(wasTheCourseAdded); }