public void OptionsRoundTrip(PasswordHashAlgorithm algorithm, int expectedSize) { // Arrange var options = new PasswordHashOptions(algorithm); // Act & assert - success case Assert.Equal(expectedSize, options.HashSize); // Arrange options.HashAlgorithm = PasswordHashAlgorithm.Sha1; options.SaltSize = expectedSize; options.HashAlgorithm = algorithm; // Act & assert - failure case Assert.Equal(expectedSize, options.HashSize); }
public static IOptions <PasswordHashOptions> BuildOptions(int?saltSize = null, int?iterations = null) { var options = new PasswordHashOptions(); if (saltSize.HasValue) { options.SaltSize = saltSize.Value; } if (iterations.HasValue) { options.Iterations = iterations.Value; } return(Options.Create(options)); }