Пример #1
0
        public void FromBase32StringInvalidArgs()
        {
            Assert.That(() => Base32Encoding.FromBase32String("A"),
                        Throws.TypeOf <FormatException>().And.Property("Message").EqualTo("The input is not a valid Base32 string."));

            Assert.That(() => Base32Encoding.FromBase32String("??"),
                        Throws.TypeOf <FormatException>().And.Property("Message").EqualTo("The input is not a valid Base32 string. The character '?' does not exist in the Base32 alphabet."));
        }
Пример #2
0
        public void FromBase32StringTest(string input, byte[] output)
        {
            var bytes = Base32Encoding.FromBase32String(input);

            if (input == null)
            {
                Assert.IsNull(bytes, "The decoded array should be null");
            }
            else
            {
                Assert.That(bytes,
                            Is.EquivalentTo(output), "The decoded arrays strings do not match");
            }
        }