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)); }
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); }
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); }