public void TransformBad() { FileTransformEngine link = new FileTransformEngine(typeof(ToClass), typeof(FromClass)); Assert.Throws <BadUsageException>(() => link.TransformFile(Common.TestPath("Good\\Transform1.txt"), Common.TestPath("Good\\transformout.txt"))); }
public void Transform3() { var link = new FileTransformEngine <FromClass3, ToClass2>(); Assert.Throws <FileNotFoundException>(() => link.TransformFile("aaskdhaklhdla", "baskdkalsd")); }
public void Transform3() { FileTransformEngine link = new FileTransformEngine(typeof(FromClass3), typeof(ToClass2)); Assert.Throws <FileNotFoundException>(() => link.TransformFile("aaskdhaklhdla", "baskdkalsd")); }
public void Transform1() { FileTransformEngine link = new FileTransformEngine(typeof(FromClass1), typeof(ToClass1)); Assert.Throws <BadUsageException>(() => link.TransformFile("a", "b")); }
public void CsvToDelimited() { FileTransformEngine link = new FileTransformEngine(typeof(FromClass), typeof(ToClass2)); link.TransformFile(Common.TestPath("Good\\Transform1.txt"), Common.TestPath("Good\\transformout.txt")); FileHelperEngine engine = new FileHelperEngine(typeof(ToClass2)); ToClass2[] res = (ToClass2[]) engine.ReadFile(Common.TestPath("Good\\transformout.txt")); if (File.Exists(Common.TestPath("Good\\transformout.txt"))) File.Delete(Common.TestPath("Good\\transformout.txt")); Assert.AreEqual(6, res.Length); }
public void CsvToFixedLength2() { FileTransformEngine link = new FileTransformEngine(typeof(FromClass), typeof(ToClass)); link.TransformFile(Common.TestPath("Good\\Transform2.txt"), Common.TestPath("Good\\transformout.txt")); FileHelperEngine engine = new FileHelperEngine(typeof(ToClass)); ToClass[] res = (ToClass[]) engine.ReadFile(Common.TestPath("Good\\transformout.txt")); if (File.Exists(Common.TestPath("Good\\transformout.txt"))) File.Delete(Common.TestPath("Good\\transformout.txt")); Assert.AreEqual(@"c:\Prueba1\anda ? ", res[0].CompanyName); Assert.AreEqual("\"D:\\Glossaries\\O12\" ", res[1].CompanyName); Assert.AreEqual(@"\\s\\ ", res[2].CompanyName); }
public void CsvToFixedLength() { var link = new FileTransformEngine <FromClass, ToClass>(); link.TransformFile(FileTest.Good.Transform1.Path, fileOut); var engine = new FileHelperEngine <ToClass>(); ToClass[] res = engine.ReadFile(fileOut); if (File.Exists(fileOut)) { File.Delete(fileOut); } Assert.AreEqual(6, res.Length); }
public void CsvToDelimited() { FileTransformEngine link = new FileTransformEngine(typeof(FromClass), typeof(ToClass2)); link.TransformFile(Common.TestPath("Good\\Transform1.txt"), Common.TestPath("Good\\transformout.txt")); FileHelperEngine engine = new FileHelperEngine(typeof(ToClass2)); ToClass2[] res = (ToClass2[])engine.ReadFile(Common.TestPath("Good\\transformout.txt")); if (File.Exists(Common.TestPath("Good\\transformout.txt"))) { File.Delete(Common.TestPath("Good\\transformout.txt")); } Assert.AreEqual(6, res.Length); }
static void FormatTransformation() { Console.WriteLine("Testing Format Transformation"); Console.WriteLine(); FileTransformEngine engine = new FileTransformEngine(typeof(Customer), typeof(Customer2)); engine.TransformFile(@"..\Data\CustomersDelimited.txt", "temp.txt"); Console.WriteLine("Format Transformation Successful"); if (File.Exists("temp.txt")) { File.Delete("temp.txt"); } Console.ReadLine(); }
public void CsvToFixedLength2() { FileTransformEngine link = new FileTransformEngine(typeof(FromClass), typeof(ToClass)); link.TransformFile(Common.TestPath("Good\\Transform2.txt"), Common.TestPath("Good\\transformout.txt")); FileHelperEngine engine = new FileHelperEngine(typeof(ToClass)); ToClass[] res = (ToClass[])engine.ReadFile(Common.TestPath("Good\\transformout.txt")); if (File.Exists(Common.TestPath("Good\\transformout.txt"))) { File.Delete(Common.TestPath("Good\\transformout.txt")); } Assert.AreEqual(@"c:\Prueba1\anda ? ", res[0].CompanyName); Assert.AreEqual("\"D:\\Glossaries\\O12\" ", res[1].CompanyName); Assert.AreEqual(@"\\s\\ ", res[2].CompanyName); }
public void CsvToFixedLength2() { var link = new FileTransformEngine <FromClass, ToClass>(); link.TransformFile(FileTest.Good.Transform2.Path, fileOut); var engine = new FileHelperEngine <ToClass>(); ToClass[] res = engine.ReadFile(fileOut); if (File.Exists(fileOut)) { File.Delete(fileOut); } Assert.AreEqual(@"c:\Prueba1\anda ? ", res[0].CompanyName); Assert.AreEqual("\"D:\\Glossaries\\O12\" ", res[1].CompanyName); Assert.AreEqual(@"\\s\\ ", res[2].CompanyName); }
public void Transform4() { FileTransformEngine link = new FileTransformEngine(typeof(FromClass4), typeof(ToClass1)); link.TransformFile("a", "b"); }
public void Transform4() { FileTransformEngine link = new FileTransformEngine(typeof(FromClass4), typeof(ToClass1)); link.TransformFile("a","b"); }
public void Transform3() { FileTransformEngine link = new FileTransformEngine(typeof(FromClass3), typeof(ToClass2)); link.TransformFile("aaskdhaklhdla","baskdkalsd"); }
public void TransformBad() { FileTransformEngine link = new FileTransformEngine(typeof(ToClass), typeof(FromClass)); link.TransformFile(TestCommon.TestPath("Good\\Transform1.txt"), TestCommon.TestPath("Good\\transformout.txt")); }
public void TransformBad() { FileTransformEngine link = new FileTransformEngine(typeof(ToClass), typeof(FromClass)); link.TransformFile(Common.TestPath("Good\\Transform1.txt"), Common.TestPath("Good\\transformout.txt")); }
static void FormatTransformation() { Console.WriteLine("Testing Format Transformation"); Console.WriteLine(); FileTransformEngine engine = new FileTransformEngine(typeof(Customer), typeof(Customer2)); engine.TransformFile(@"..\Data\CustomersDelimited.txt", "temp.txt"); Console.WriteLine("Format Transformation Successful"); if (File.Exists("temp.txt")) File.Delete("temp.txt"); Console.ReadLine(); }
/// <summary>Transform the records of type sourceType in the sourceFile in records of type destType and write them to the destFile. (but returns the transformed records) WARNING: this is a slower method that the TransformFileAssync.</summary> /// <param name="sourceType">The Type of the records in the source File.</param> /// <param name="destType">The Type of the records in the dest File.</param> /// <param name="sourceFile">The file with records to be transformed</param> /// <param name="destFile">The destination file with the transformed records</param> /// <returns>The transformed records.</returns> public static object[] TransformFile(string sourceFile, Type sourceType, string destFile, Type destType) { var engine = new FileTransformEngine(sourceType, destType); return(engine.TransformFile(sourceFile, destFile)); }