Пример #1
0
		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 ());
		}
Пример #2
0
		void SaveOptions ()
		{
			if (options == null) {
				OnSaveOptions (null);
				return;
			}
			
			ArrayList list = new ArrayList ();
			foreach (DictionaryEntry e in options) {
				OptionsData d = new OptionsData ((string) e.Key, ((Hashtable) e.Value).Values);
				list.Add (d);
			}
			
			OnSaveOptions ((OptionsData[]) list.ToArray (typeof(OptionsData)));
		}