public void Open(string filename) { XmlConfigFile existingModel = this.Model; UnitTestFileViewModel existingUTModel = this.UnitTestFile; try { ActiveConfig.DB.CanCache = true; AcmaSchemaAttribute.MissingAttributeEvent += AcmaSchemaAttribute_MissingAttributeEvent; UINotifyPropertyChanges.BeginIgnoreAllChanges(); this.Model = ActiveConfig.LoadXml(filename); this.unitTestFile = TestEngine.UnitTestFile.LoadXml(this.FileName); this.ReloadRootNodes(); this.ResetChangeState(); } catch { this.Model = existingModel; this.UnitTestFile = existingUTModel; throw; } finally { UINotifyPropertyChanges.EndIgnoreAllChanges(); this.RaisePropertyChanged("DisplayName"); this.RaisePropertyChanged("ChildNodes"); AcmaSchemaAttribute.ClearLostFoundCache(); AcmaSchemaAttribute.MissingAttributeEvent -= AcmaSchemaAttribute_MissingAttributeEvent; ActiveConfig.DB.CanCache = false; } }
public static void ExportUnitTestAsDocX(string fileName, UnitTestFileViewModel unitTestFile) { DocX doc = DocX.Create(fileName); doc.AddFooters(); doc.Footers.even.InsertParagraph(unitTestFile.FileName); doc.Footers.odd.InsertParagraph(unitTestFile.FileName); Paragraph p = doc.InsertParagraph(); p = doc.InsertParagraph(); p.StyleName = "Title"; p.InsertText("Acma Unit Test Definitions"); doc.InsertSectionPageBreak(); foreach (var unitTest in unitTestFile.UnitTestObjects) { if (unitTest is UnitTestGroupViewModel) { DocXExporter.WriteUnitTestGroup(unitTest as UnitTestGroupViewModel, doc); } else if (unitTest is UnitTestViewModel) { DocXExporter.WriteUnitTest(unitTest as UnitTestViewModel, doc); } else { throw new ArgumentException("Unknown unit test object"); } doc.InsertSectionPageBreak(); } doc.Save(); }
private BitmapSource GetIcon(UnitTestFileViewModel item) { return(new BitmapImage(new Uri("pack://application:,,,/Lithnet.Acma.Presentation;component/Resources/UnitTests.png", UriKind.Absolute))); }