Пример #1
0
        public void SignIn_Should_ReturnFalse(string username, string password, string error)
        {
            // Create a user in the DAL
            AddUserToDAL("test");
            var provider = new SessionAuthProvider(mockAccessor.Object, mockUserDal.Object);

            // Call our method with different credentials
            bool success = provider.SignIn(username, password);

            Assert.IsFalse(success, error);
        }
Пример #2
0
        public void SignIn_Should_ReturnTrueIfMatch()
        {
            // Arrange the DAL to have a user
            AddUserToDAL("test");
            var provider = new SessionAuthProvider(mockAccessor.Object, mockUserDal.Object);

            // Call our method to test
            bool success = provider.SignIn("test", "password123");

            // Assert
            Assert.IsTrue(success);
            // Asserts Set was called in session
            mockSession.Verify(m => m.Set(SessionAuthProvider.SessionKey, It.IsAny <byte[]>()));
        }