public void FromBase32String(string expected, string input) { byte[] expectedBytes = Encoding.ASCII.GetBytes(expected); byte[] actual = Base32Converter.FromBase32String(input); Assert.Equal(BitConverter.ToString(expectedBytes), BitConverter.ToString(actual)); }
public void ToBase32String(string input, string expected) { byte[] bytes = Encoding.ASCII.GetBytes(input); string actual = Base32Converter.ToBase32String(bytes); Assert.Equal(expected, actual); }
public void Base32RoundTrip() { var input = new byte[4096]; new Random().NextBytes(input); var base32 = Base32Converter.ToBase32String(input); var output = Base32Converter.FromBase32String(base32); Assert.Equal(input, output); }
public void ToBase32String_Null_ShouldThrow() { Assert.Throws <ArgumentNullException>(() => Base32Converter.ToBase32String(null)); }
public void FromBase32String_InvalidCharacters(char input) { var exception = Assert.Throws <ArgumentException>(() => Base32Converter.FromBase32String(input + "A")); Assert.Contains("'" + input + "'", exception.Message); }
public void FromBase32String_InvalidLength(string input) { Assert.Throws <ArgumentException>(() => Base32Converter.FromBase32String(input)); }