protected virtual void OnSaveOptions(OptionsData[] data) { IConfigurationTarget ce; string path; GetOwnerSolutionItem(this, out ce, out path); if (ce == null) { throw new InvalidOperationException("Options can't be saved."); } foreach (OptionsData d in data) { IExtendedDataItem edi = (IExtendedDataItem)ce.Configurations [d.Configuration]; if (edi == null) { continue; } UnitTestOptionsSet oset = (UnitTestOptionsSet)edi.ExtendedProperties ["UnitTestInformation"]; if (oset == null) { oset = new UnitTestOptionsSet(); edi.ExtendedProperties ["UnitTestInformation"] = oset; } UnitTestOptionsEntry te = oset.FindEntry(path); if (d.Options.Count > 0) { if (te == null) { te = new UnitTestOptionsEntry(); te.Path = path; oset.Tests.Add(te); } te.Options.Clear(); te.Options.AddRange(d.Options); } else if (te != null) { oset.Tests.Remove(te); } } ce.Save(new NullProgressMonitor()); }
protected virtual ICollection OnLoadOptions(string configuration) { IConfigurationTarget ce; string path; GetOwnerSolutionItem(this, out ce, out path); if (ce == null) { return(null); } IExtendedDataItem edi = (IExtendedDataItem)ce.Configurations [configuration]; if (edi == null) { return(null); } UnitTestOptionsSet oset = (UnitTestOptionsSet)edi.ExtendedProperties ["UnitTestInformation"]; if (oset == null) { return(null); } UnitTestOptionsEntry te = oset.FindEntry(path); if (te != null) { return(te.Options); } else { return(null); } }
protected virtual void OnSaveOptions (OptionsData[] data) { IConfigurationTarget ce; string path; GetOwnerSolutionItem (this, out ce, out path); if (ce == null) throw new InvalidOperationException ("Options can't be saved."); foreach (OptionsData d in data) { IExtendedDataItem edi = (IExtendedDataItem) ce.Configurations [d.Configuration]; if (edi == null) continue; UnitTestOptionsSet oset = (UnitTestOptionsSet) edi.ExtendedProperties ["UnitTestInformation"]; if (oset == null) { oset = new UnitTestOptionsSet (); edi.ExtendedProperties ["UnitTestInformation"] = oset; } UnitTestOptionsEntry te = oset.FindEntry (path); if (d.Options.Count > 0) { if (te == null) { te = new UnitTestOptionsEntry (); te.Path = path; oset.Tests.Add (te); } te.Options.Clear (); te.Options.AddRange (d.Options); } else if (te != null) { oset.Tests.Remove (te); } } ce.Save (new NullProgressMonitor ()); }