public void RemoveSession_ThrowException_WhenSessionIsNull() { //ARRANGE var assistant = new RSAssistantRole(MockUofW.Object); //ASSERT Assert.ThrowsException <ArgumentNullException>(() => assistant.RemoveSession(null)); }
public void RemoveSession_ThrowException_WhenSessionIdIsZero() { //ARRANGE var sessionIdZero = new SessionTO { Id = 0, Course = null }; var assistant = new RSAssistantRole(MockUofW.Object); //ASSERT Assert.ThrowsException <Exception>(() => assistant.RemoveSession(sessionIdZero)); }
public void RemoveSession_ReturnsTrue_WhenSessionIsProvidedAndRemovedFromDB_Test() { //ARRANGE MockSessionRepository.Setup(x => x.Remove(It.IsAny <SessionTO>())); MockUofW.Setup(x => x.SessionRepository).Returns(MockSessionRepository.Object); var assistant = new RSAssistantRole(MockUofW.Object); var sessionToRemove = new SessionTO { Id = 1, Course = course, Teacher = teacher }; //ASSERT Assert.IsTrue(assistant.RemoveSession(sessionToRemove)); }
public void RemoveSession_UserRepositoryIsCalledOnce_WhenAValidSessionIsProvidedAndRemovedFromDB() { //ARRANGE MockSessionRepository.Setup(x => x.Remove(It.IsAny <SessionTO>())); MockUofW.Setup(x => x.SessionRepository).Returns(MockSessionRepository.Object); var ass = new RSAssistantRole(MockUofW.Object); var sessionToRemoveOnce = new SessionTO { Id = 1, Course = course, Teacher = teacher }; //ACT ass.RemoveSession(sessionToRemoveOnce); MockSessionRepository.Verify(x => x.Remove(It.IsAny <SessionTO>()), Times.Once); }