private MChessOptions CreateBaseMChessOptions() { var opts = new MChessOptions(); // Add the options derived from the test method hierarchy. (these aren't specified by the context) opts.IncludedAssemblies = ChessTestUtil.GetAssembliesToInstrument(Test.OwningTestMethod).ToArray(); ChessTestUtil.SetPreemptionOptions(opts, Test.OwningTestMethod); // ** Add options that come from the context var context = TestContext as IMChessTestContext; if (context != null) { opts.MergeWith(context.ToMChessOptions()); } return(opts); }
/// <summary> /// Gets the elements from the test list hierarchy that apply to each test that uses /// MChess as its runner. All elements returned are clones. /// </summary> /// <returns></returns> public IEnumerable <XElement> GetApplicableChessElementsSharedAccrossTestTypes() { // Add only the applicable instrumentation assemblies foreach (var assy in ChessTestUtil.GetAssembliesToInstrument(this)) { yield return(new XElement(XChessNames.InstrumentAssembly, assy)); } // Add preemption settings bool?defaultPreemptability; var xtogglePreempts = ChessTestUtil.GetTogglePreemptionElements(this, out defaultPreemptability); if (defaultPreemptability.HasValue) { yield return(new XElement(XChessNames.DefaultPreemptability, defaultPreemptability.Value)); } foreach (var x in xtogglePreempts) { yield return(new XElement(x)); // Add copies } }