public void AddSession_ThrowException_WhenSessionIsNull() { //ARRANGE var assistant = new RSAssistantRole(MockUofW.Object); //ASSERT Assert.ThrowsException <ArgumentNullException>(() => assistant.AddSession(null)); }
public void AddSession_ThrowException_WhenSessionIDisDiferentThanZero() { //ARRANGE var assistant = new RSAssistantRole(new Mock <IRSUnitOfWork>().Object); var sessionToAdd = new SessionTO { Id = 1, Course = null, Teacher = null }; //ASSERT Assert.ThrowsException <Exception>(() => assistant.AddSession(sessionToAdd)); }
public void AddSession_UserRepositoryIsCalledOnce_WhenAValidSessionIsProvidedAndAddInDB() { //ARRANGE MockSessionRepository.Setup(x => x.Add(It.IsAny <SessionTO>())); MockUofW.Setup(x => x.SessionRepository).Returns(MockSessionRepository.Object); var ass = new RSAssistantRole(MockUofW.Object); var newSession = new SessionTO { Id = 0, Course = course, Teacher = teacher }; //ACT ass.AddSession(newSession); MockSessionRepository.Verify(x => x.Add(It.IsAny <SessionTO>()), Times.Once); }
public void AddSession_NewSession_Test() { //ARRANGE var newSession = new SessionTO { Id = 0, Course = course, Teacher = teacher, Attendees = null }; MockSessionRepository.Setup(x => x.Add(It.IsAny <SessionTO>())); var mockUofW = new Mock <IRSUnitOfWork>(); mockUofW.Setup(x => x.SessionRepository).Returns(MockSessionRepository.Object); var assistant = new RSAssistantRole(mockUofW.Object); //ASSERT Assert.IsTrue(assistant.AddSession(newSession)); }