public TestSessionLogXmlAssert(string xml) { _xml = xml; _testSessionLog = DeserializeXml(xml); TestSessionLogXmlValidator.Validate(xml); }
private static string CreateXml(testSessionLog log) { StringWriter sw = new StringWriter(); XmlSerializer xml = new XmlSerializer(typeof(testSessionLog)); xml.Serialize(sw, log); return sw.ToString(); }
public void GenerateXmlAndSaveToFile(TestSession testSession) { string pathToLogFile = testSession.Archive.WorkingDirectory.RepositoryOperations() .WithFile(ArkadeConstants.ArkadeXmlLogFileName) .FullName; testSessionLog log = GetTestSessionLog(testSession); FileStream fs = new FileStream(pathToLogFile, FileMode.Create); XmlSerializer xmls = new XmlSerializer(typeof(testSessionLog)); xmls.Serialize(fs, log); fs.Close(); }
private static testSessionLog GetTestSessionLog(TestSession testSession) { testSessionLog log = new testSessionLog(); log.timestamp = DateTime.Now; log.arkadeVersion = ArkadeVersion.Current; log.archiveType = testSession?.Archive?.ArchiveType.ToString(); log.archiveUuid = testSession?.Archive?.Uuid?.GetValue(); log.logEntries = GetLogEntries(testSession); log.testResults = GetTestResults(testSession); return log; }