Пример #1
0
        public void LoginAuthenicationServiceReturnsFailedResultIfUserIdIsNotInDataBase()
        {
            var service = new LoginAuthenticationService(MockDataAccessForUserNotInDatabase().Object, new RijnadelEncryptionCipher(), EncryptionKey);

            AuthenicationResult result = service.Authenicate(UnRegisteredUser, InCorrectPassword.ToSecureString());

            Assert.IsNotNull(result);
            Assert.IsFalse(result.IsSuccessful);
            Assert.AreEqual("Login Authenication Failed. Invalid UserName or Password.", result.Message);
        }
Пример #2
0
        public void LoginAuthenicationServiceReturnsFailedResultIfDataAccessLayerFails()
        {
            var service = new LoginAuthenticationService(MockFailingDataAccess().Object, new RijnadelEncryptionCipher(), EncryptionKey);

            AuthenicationResult result = service.Authenicate(UserId, CorrectPassword.ToSecureString());

            Assert.IsNotNull(result);
            Assert.IsFalse(result.IsSuccessful);
            Assert.AreEqual("Login Authenication Failed. Unable to connect to database. Please contact support.", result.Message);
        }
Пример #3
0
        public void LoginAuthenicationServiceReturnsSuccessfulResultIfPasswordsMatch()
        {
            var service = new LoginAuthenticationService(MockDataAccess().Object, new RijnadelEncryptionCipher(), EncryptionKey);

            AuthenicationResult result = service.Authenicate(UserId, CorrectPassword.ToSecureString());

            Assert.IsNotNull(result);
            Assert.IsTrue(result.IsSuccessful);
            Assert.AreEqual("Login Authenication successful.", result.Message);
        }