public void EncodeToString_KnownArgumentASCII() { byte[] stringBytes = Encoding.ASCII.GetBytes("Hello world"); string expectedResult = Encoding.ASCII.GetString(new byte[] { 83, 71, 86, 115, 98, 71, 56, 103, 100, 50, 57, 121, 98, 71, 81, 61 }); string result = Base64Encoder.EncodeToString(stringBytes); Assert.AreEqual(expectedResult, result); }
public void EncodeToString_KnownArgumentBytes() { byte[] bytes = new byte[] { 0x00, 0x01, 0x03, 0x03, 0x07, 0x00 }; string expectedResult = Encoding.ASCII.GetString(new byte[] { 65, 65, 69, 68, 65, 119, 99, 65 }); string result = Base64Encoder.EncodeToString(bytes); Assert.AreEqual(expectedResult, result); }
public void EncodeToString_KnownArgumentUTF8() { byte[] stringBytes = Encoding.UTF8.GetBytes("檔案"); string expectedResult = Encoding.ASCII.GetString(new byte[] { 53, 113, 113, 85, 53, 113, 71, 73 }); string result = Base64Encoder.EncodeToString(stringBytes); Assert.AreEqual(expectedResult, result); }