public void TestSafe64EncodingAllChars() { //char count must by multiple of 4 for the compare to work string encoded = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-_"; byte[] data = Safe64Encoding.DecodeBytes(encoded); Assert.AreEqual(encoded, Safe64Encoding.EncodeBytes(data)); data = AsciiEncoder.DecodeBytes(encoded); Assert.AreEqual(encoded, AsciiEncoder.EncodeBytes(data)); data = AsciiEncoder.DecodeBytes(Encoding.ASCII.GetBytes(encoded)); Assert.AreEqual(encoded, AsciiEncoder.EncodeBytes(data)); }
public void TestSafe64EncodingLargeArray() { Random rand = new Random(); byte[] data = new byte[0x400000]; rand.NextBytes(data); string testAsc = Safe64Encoding.EncodeBytes(data); Assert.AreEqual(0, BinaryComparer.Compare(data, Safe64Encoding.DecodeBytes(testAsc))); testAsc = AsciiEncoder.EncodeBytes(data); Assert.AreEqual(0, BinaryComparer.Compare(data, AsciiEncoder.DecodeBytes(testAsc))); }