public void UpdateSession_ThrowException_WhenSessionIsNull() { //ARRANGE var assistant = new RSAssistantRole(MockUofW.Object); //ASSERT Assert.ThrowsException <ArgumentNullException>(() => assistant.UpdateSession(null)); }
public void UpdateSession_ThrowException_WhenSessionIdIsZero() { //ARRANGE var sessionIdZero = new SessionTO { Id = 0, Course = null }; var assistant = new RSAssistantRole(MockUofW.Object); //ASSERT Assert.ThrowsException <Exception>(() => assistant.UpdateSession(sessionIdZero)); }
public void UpdateSession_ReturnsTrue_WhenAValidSessionIsProvidedAndUpdatedInDB() { //ARRANGE MockSessionRepository.Setup(x => x.Update(It.IsAny <SessionTO>())); MockUofW.Setup(x => x.SessionRepository).Returns(MockSessionRepository.Object); var assistant = new RSAssistantRole(MockUofW.Object); var user = new SessionTO { Id = 1, Course = course, Teacher = teacher }; //ASSERT Assert.IsTrue(assistant.UpdateSession(user)); }
public void UpdateSession_UserRepositoryIsCalledOnce_WhenAValidSessionIsProvidedAndUpdatedInDB() { //ARRANGE MockSessionRepository.Setup(x => x.Update(It.IsAny <SessionTO>())); MockUofW.Setup(x => x.SessionRepository).Returns(MockSessionRepository.Object); var ass = new RSAssistantRole(MockUofW.Object); var userToUpdate = new SessionTO { Id = 1, Course = course, Teacher = teacher }; //ACT ass.UpdateSession(userToUpdate); MockSessionRepository.Verify(x => x.Update(It.IsAny <SessionTO>()), Times.Once); }