Exemplo n.º 1
0
        public void RemoveSession_ThrowException_WhenSessionIsNull()
        {
            //ARRANGE
            var assistant = new RSAssistantRole(MockUofW.Object);

            //ASSERT
            Assert.ThrowsException <ArgumentNullException>(() => assistant.RemoveSession(null));
        }
Exemplo n.º 2
0
        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));
        }
Exemplo n.º 3
0
        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));
        }
Exemplo n.º 4
0
        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);
        }