private static bool SaveWSOFile(string filePath, MainViewModel viewmodel) { // Get UIOptionRootType from View Model UIOptionRootType rootOptions = OptionMapper.DefaultXmlToOptionModel(); OptionMapper.UIModelToOptionModel(rootOptions, viewmodel, false); IVisitorWithContext visitor = new XmlWriteVisitor(); rootOptions.Accept(visitor, filePath); return true; }
public void TestXmlWriter() { UIOptionRootType optionsRoot = TestHelper.ReadTestXML(); IVisitorWithContext writeVisitor = new XmlWriteVisitor(); optionsRoot.Accept(writeVisitor, _xmlOutputPath); Assert.IsTrue(File.Exists(_xmlOutputPath)); FileInfo original = new FileInfo(_xmlOriginalPath); FileInfo generated = new FileInfo(_xmlOutputPath); Assert.AreEqual(original.Length, generated.Length); }