示例#1
0
        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));
        }
示例#2
0
        public void ToBase32String(string input, string expected)
        {
            byte[] bytes  = Encoding.ASCII.GetBytes(input);
            string actual = Base32Converter.ToBase32String(bytes);

            Assert.Equal(expected, actual);
        }
示例#3
0
        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);
        }
示例#4
0
 public void ToBase32String_Null_ShouldThrow()
 {
     Assert.Throws <ArgumentNullException>(() => Base32Converter.ToBase32String(null));
 }
示例#5
0
        public void FromBase32String_InvalidCharacters(char input)
        {
            var exception = Assert.Throws <ArgumentException>(() => Base32Converter.FromBase32String(input + "A"));

            Assert.Contains("'" + input + "'", exception.Message);
        }
示例#6
0
 public void FromBase32String_InvalidLength(string input)
 {
     Assert.Throws <ArgumentException>(() => Base32Converter.FromBase32String(input));
 }