Ejemplo n.º 1
0
        public void GenerateCredentials_EmptyPassword_ReturnsNull()
        {
            UserEntity user = new UserEntity();
            user.ID = Guid.NewGuid();
            user.FirstName = "Test";
            user.UserPassword = string.Empty;

            PasswordService service = new PasswordService();
            UserEntity retrieved = service.GenerateCredentials(user);
            Assert.IsNull(retrieved);
        }
Ejemplo n.º 2
0
        public void GenerateCredentials_ValidUserEntity_ReturnedWithFields()
        {
            string plaintext = "Password123456789";

            UserEntity user = new UserEntity();
            user.ID = Guid.NewGuid();
            user.FirstName = "Test";
            user.UserPassword = "******";

            PasswordService service = new PasswordService();
            UserEntity retrieved = service.GenerateCredentials(user);

            StringAssert.DoesNotMatch(plaintext, retrieved.UserPassword);
            Assert.NotNull(user.Registered);
            Assert.NotNull(user.Salt);
            Assert.NotNull(user.UserPassword);
        }
Ejemplo n.º 3
0
 public void GenerateCredentials_NullUserEntity_ReturnsNull()
 {
     PasswordService service = new PasswordService();
     UserEntity retrieved = service.GenerateCredentials(null);
     Assert.IsNull(retrieved);
 }