예제 #1
0
        public AutoMapping()
        {
            CreateMap <User, UserViewModel>().BeforeMap((a, b) => a.Password = null);

            //no mapeamento automaticamente converte a string de senha para hash
            CreateMap <UserViewModel, User>().BeforeMap((a, b) => a.Password = AuthHelpers.getHashOfString(a.Password));

            CreateMap <UserAuthViewModel, User>().BeforeMap((a, b) => a.Password = AuthHelpers.getHashOfString(a.Password));
        }
예제 #2
0
        public void different_string_has_diferrent_hash()
        {
            //Arrange
            var password  = "******";
            var password2 = "wenderpatrick1122$";

            //act
            var hash = AuthHelpers.getHashOfString(password);

            //assert
            Assert.NotEqual(AuthHelpers.getHashOfString(password2), hash);
        }
예제 #3
0
        public void can_hash_twice_same_string()
        {
            // Arrange
            var password  = "******";
            var password2 = "WenderPatrick1122$";

            // Act
            var hash = AuthHelpers.getHashOfString(password);

            //Assert
            Assert.Equal(AuthHelpers.getHashOfString(password2), hash);
        }