|
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace Catel.Test.Convert
{
/// <summary>
/// Summary description for ConvertTest
/// </summary>
[TestClass]
public class ConvertTest
{
//[TestMethod]
//public void ConvertAndReconvert()
//{
// // Create a temp file
// string tempFile1 = Path.GetTempFileName();
// string tempFile2 = Path.GetTempFileName();
// // Create file contents
// string stringContents = "";
// for (int i = 0; i < 26; i++)
// {
// stringContents += ((char)i).ToString();
// }
// byte[] binaryContents = ASCIIEncoding.ASCII.GetBytes(stringContents);
// // Create file
// FileStream fileStream = new FileStream(tempFile1, FileMode.Create);
// fileStream.Write(binaryContents, 0, binaryContents.Length);
// fileStream.Close();
// // Encode and decode
// string encodedContent = Catel.Convert.FileToBase64(tempFile1);
// Assert.IsTrue(Catel.Convert.FileFromBase64(encodedContent, tempFile2));
// // Read file contents
// TextReader textReader1 = new StreamReader(tempFile1, Encoding.Default);
// string fileContents1 = textReader1.ReadToEnd();
// textReader1.Close();
// TextReader textReader2 = new StreamReader(tempFile2, Encoding.Default);
// string fileContents2 = textReader2.ReadToEnd();
// textReader2.Close();
// // Check if contents are the same
// Assert.AreEqual(fileContents1, fileContents2);
// // Delete the temporary files
// File.Delete(tempFile1);
// File.Delete(tempFile2);
//}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.