static void Base64Decode(string data, bool showHelp) { if (showHelp) { List <Parameter> parms = new List <Parameter> { new Parameter { Key = "data", Type = typeof(string), HelpText = "Text to decode" } }; ConsoleColor defaultColor = Console.ForegroundColor; Console_WriteLine($"Parameter options for base64 decode:\r\n", ConsoleColor.Green); WriteMethodParametersHelp(parms); Console.ForegroundColor = defaultColor; } else { Console.WriteLine($"Decoding base64 data to string.\r\n"); Console.WriteLine(EncodingHelpers.FromBase64(data)); } }
public void FromBase64_NonBase64String() { string _nonBase64String = "abc"; Assert.Throws <FormatException>(() => EncodingHelpers.ToBase64(EncodingHelpers.FromBase64(_nonBase64String))); }
public void FromBase64_Base64String(string encodedString) { Assert.AreEqual(encodedString, EncodingHelpers.ToBase64(EncodingHelpers.FromBase64(encodedString))); }
public void FromBase64_NullString() { Assert.Throws <ArgumentNullException>(() => EncodingHelpers.FromBase64(_nullString)); }
public void ToBase64_String(string plainText) { Assert.AreEqual(plainText, EncodingHelpers.FromBase64(EncodingHelpers.ToBase64(plainText))); }