public void Serialize(IEnumerable <object> dataObjects) { testsuite suite = MapToTestSuite(dataObjects); XmlSerializer serializer = new XmlSerializer(typeof(testsuite)); var fileStream = new FileStream(_path, FileMode.Create); var textWriter = new StreamWriter(fileStream, Encoding.GetEncoding(1250)); serializer.Serialize(textWriter, suite); textWriter.Close(); }
private testsuite MapToTestSuite(IEnumerable <object> dataObjects) { testsuite suite = new testsuite(); suite.errors = dataObjects.Count(x => KeywordStatus.Error.ToString().Equals(((Keyword)x).Status)).ToString(); suite.skipped = dataObjects.Count(x => KeywordStatus.Skipped.ToString().Equals(((Keyword)x).Status)).ToString(); suite.tests = dataObjects.Count().ToString(); suite.name = GetSuiteName(dataObjects); suite.testcase = dataObjects.Select(keyword => MapToTestCase((Keyword)keyword)).ToArray(); return(suite); }