public static void WriteFinalToFile(ITestResults foo, string fileName) { var serializer = new XmlSerializer(foo.GetType()); using (var writer = new StreamWriter(string.Format("{0}{1}.xml", fileName, DateTime.Now.Ticks))) { serializer.Serialize(writer, foo); } }
public static void WriteToFile(ITestResults foo, string fileName) { var serializer = new XmlSerializer(foo.GetType()); var writer = new StreamWriter(string.Format("{0}-{1}.xml", fileName, DateTime.Now.Ticks)); serializer.Serialize(writer, foo); writer.Close(); writer.Dispose(); }
public static void WriteToFile(ITestResults foo, string fileName) { XmlSerializer serializer = new XmlSerializer(foo.GetType()); Directory.CreateDirectory(Configuration.NUnitModifiedTestResultLocation); using (var writer = new StreamWriter(string.Format("{0}{1}-{2}.xml", Configuration.NUnitModifiedTestResultLocation, fileName, DateTime.Now.Ticks))) { serializer.Serialize(writer, foo); } }
public void GetOutput(ITestResults results) { var type = results.GetType(); foreach (var property in type.GetProperties()) { if (property.GetValue(results) is DateTime propertyDate) { Console.Write($"{property.Name}: {propertyDate:dd/MM/yyyy} "); } else { Console.Write($"{property.Name}: {property.GetValue(results)} "); } } Console.WriteLine(); }