예제 #1
0
        public void ChangePassword_Should_ReturnFalseIfNotLoggedIn()
        {
            // Arrange
            var provider = new SessionAuthProvider(mockAccessor.Object, mockUserDal.Object);

            // Act
            var result = provider.ChangePassword("password", "password1234");

            // Assert
            Assert.IsFalse(result);
        }
예제 #2
0
        public void ChangePassword_Should_ReturnFalseIfCredentialsDontMatch()
        {
            // Arrange
            AddUserToDAL("test");
            AddUserToSession("test");
            var provider = new SessionAuthProvider(mockAccessor.Object, mockUserDal.Object);

            // Act
            var result = provider.ChangePassword("wrongpassword", "newpassword");

            // Assert
            Assert.IsFalse(result);
        }
예제 #3
0
        public void ChangePassword_Should_UpdateIfCredentialsMatch()
        {
            // Arrange
            AddUserToDAL("test");
            AddUserToSession("test");
            var provider = new SessionAuthProvider(mockAccessor.Object, mockUserDal.Object);

            // Act
            var result = provider.ChangePassword("password123", "newpassword");

            // Assert
            Assert.IsTrue(result);
            mockUserDal.Verify(m => m.UpdateUser(It.IsAny <User>()));
        }