Example #1
0
        public byte[] Resolve(UserDto source, User destination, byte[] destMember, ResolutionContext context)
        {
            var encoding = new PasswordEncodingService();

            byte[] password = null;
            if (source.Password != null)
            {
                password = encoding.CalculateSHA256(source.Password);
            }
            return(password);
        }
Example #2
0
        public void PasswordEncodingService_Encode()
        {
            //Arrange
            var password = "******";
            //Act
            var encoded = encodingService.CalculateSHA256(password);

            //Assert
            Assert.NotNull(encoded);
            Assert.IsNotEmpty(encoded);
            Assert.AreEqual(encoded.Length, 32);
        }
Example #3
0
        public void SetUp()
        {
            repository = new UserRepository(new BoengServiceWebSiteContext());
            var encoder = new PasswordEncodingService();

            user = new User()
            {
                Name = "Colin", RegistrationDate = DateTime.UtcNow, Role = 2, Password = encoder.CalculateSHA256("qwerty")
            };
            UserRepository_AddUser(user);
        }