public void UpdateCourse_ThrowException_WhenCourseIsNull() { //ARRANGE var ass = new RSAssistantRole(new Mock <IRSUnitOfWork>().Object); //ASSERT Assert.ThrowsException <ArgumentNullException>(() => ass.UpdateCourse(null)); }
public void UpdateCourse_ThrowsIsNullOrWhiteSpaceException_WhenWhiteSpaceNameIsProvided() { //ARRANGE var ass = new RSAssistantRole(MockUofW.Object); var courseNameWhiteSpace = new CourseTO { Id = 1, Name = " " }; //ASSERT Assert.ThrowsException <IsNullOrWhiteSpaceException>(() => ass.UpdateCourse(courseNameWhiteSpace)); }
public void UpdateCourse_ReturnsTrue_WhenAValidCourseIsProvidedAndUpdatedInDB() { MockCourseRepository.Setup(x => x.Update(It.IsAny <CourseTO>())); MockUofW.Setup(x => x.CourseRepository).Returns(MockCourseRepository.Object); var ass = new RSAssistantRole(MockUofW.Object); var course = new CourseTO { Id = 1, Name = "Name" }; Assert.IsTrue(ass.UpdateCourse(course)); }
public void UpdateCourse_CourseRepositoryIsCalledOnce_WhenAValidCourseIsProvidedAndUpdatedInDB() { //ARRANGE MockCourseRepository.Setup(x => x.Update(It.IsAny <CourseTO>())); MockUofW.Setup(x => x.CourseRepository).Returns(MockCourseRepository.Object); var ass = new RSAssistantRole(MockUofW.Object); var course = new CourseTO { Id = 1, Name = "Name" }; //ACT ass.UpdateCourse(course); //VERIFY MockCourseRepository.Verify(x => x.Update(It.IsAny <CourseTO>()), Times.Once); }