public void DeleteCourse_ValidGuid_RemovesCourse() { var studentId = Guid.NewGuid(); var testList = CourseFactory.Create_TwoCourseEntities_ValidMinimumAndId_CustomStudentId(studentId); var testRepo = new MockRepository <CourseEntity>(testList); var testClass = InteractorFactory.Create_CourseInteractor(); testClass.Repo = testRepo; var testGuid = testRepo.GetAll().First().Id; testClass.DeleteCourse(testGuid); var result = testClass.GetCoursesByStudentId(studentId); result.Count.ShouldBe(1); }
public void UpdateCourse_ValidObject_UpdatesCourse() { var studentId = Guid.NewGuid(); var testList = CourseFactory.Create_TwoCourseEntities_ValidMinimumAndId_CustomStudentId(studentId); var testRepo = new MockRepository <CourseEntity>(testList); var testClass = InteractorFactory.Create_CourseInteractor(); testClass.Repo = testRepo; var courseToUpdate = testRepo.GetAll().First(); var updatedCourse = new CourseEntity { Id = courseToUpdate.Id, Name = "Intermediate Physics", Number = "1265" }; testClass.UpdateCourse(updatedCourse); var result = testClass.GetCourse(courseToUpdate.Id); result.LastModified.ShouldNotBeSameAs(courseToUpdate.LastModified); result.Name.ShouldBe("Intermediate Physics"); result.Number.ShouldBe("1265"); }