Пример #1
0
        public void GetStoredCredentials_returns_null_when_no_user_found(LoginCredentials credentials,
                                                                         UserCredentialsRepository sut)
        {
            // Act
            var result = sut.GetStoredCredentials(credentials);

            // Assert
            Assert.IsNull(result);
        }
Пример #2
0
        public void GetStoredCredentials_returns_correct_identity_when_user_found(LoginCredentials credentials,
                                                                                  User user,
                                                                                  [Frozen, InMemory] IEntityData data,
                                                                                  UserCredentialsRepository sut)
        {
            // Arrange
            user.GenerateIdentity();
            user.Username = credentials.Username;
            data.Add(user);

            // Act
            var result = sut.GetStoredCredentials(credentials);

            // Assert
            Assert.AreEqual(user.GetIdentity(), result.UserInformation.Identity);
        }
Пример #3
0
        public void GetStoredCredentials_returns_matching_serialized_credentials_when_user_found(LoginCredentials credentials,
                                                                                                 User user,
                                                                                                 [Frozen, InMemory] IEntityData data,
                                                                                                 UserCredentialsRepository sut)
        {
            // Arrange
            user.GenerateIdentity();
            user.Username = credentials.Username;
            data.Add(user);

            // Act
            var result = sut.GetStoredCredentials(credentials);

            // Assert
            Assert.AreEqual(user.SerializedCredentials, result.SerializedCredentials);
        }
Пример #4
0
        public void GetStoredCredentials_returns_credentials_when_user_is_found(LoginCredentials credentials,
                                                                                User user,
                                                                                [Frozen, InMemory] IEntityData data,
                                                                                UserCredentialsRepository sut)
        {
            // Arrange
            user.GenerateIdentity();
            user.Username = credentials.Username;
            data.Add(user);

            // Act
            var result = sut.GetStoredCredentials(credentials);

            // Assert
            Assert.NotNull(result);
        }
Пример #5
0
 public void GetStoredCredentials_throws_exception_when_credentials_are_null(UserCredentialsRepository sut)
 {
     // Act & Assert
     Assert.Throws <ArgumentNullException>(() => sut.GetStoredCredentials(null));
 }