protected override void OnBindToContext()
        {
            base.OnBindToContext();

            Applicable &= Context.ChessResult != null;
            if (!Applicable)
            {
                return;
            }

            XAction     = Context.ChessResult.GetChessXActionMatchingStartOf(this.Text);
            Applicable &= XAction != null;
            if (!Applicable)
            {
                return;
            }

            Enabled &= !Context.TestRun.HasTestSourceChanged;

            Text = Text.Replace("Repro", GetSpecializedReproName());

            var opts = new MChessOptions();

            opts.EnableRepro   = true;
            opts.EnableTracing = true;
            opts.TargetRace    = (int?)XAction.Attribute(XChessNames.ARace);
            opts.XSchedule     = Context.ChessResult.DataElement.Element(XChessNames.Schedule);

            // Merge with existing options
            opts.MergeWith(MChessOptions);
            MChessOptions = opts;
        }
        protected override void OnBindToContext()
        {
            base.OnBindToContext();
            if (!Applicable)
            {
                return;
            }

            XElement xaction = Context.TestRun.GetChessXActionMatchingStartOf(Text);

            Applicable &= xaction != null && Context.LastXSchedule != null;
            if (!Applicable)
            {
                return;
            }

            // Need to add the last schedule from the TestRun
            var opts = new MChessOptions();

            opts.ContinueFromLastSchedule = true;
            opts.XSchedule = Context.LastXSchedule;

            // Merge with existing options
            opts.MergeWith(MChessOptions);
            MChessOptions = opts;
        }
Esempio n. 3
0
        protected override void OnBindToContext()
        {
            base.OnBindToContext();
            if (!Applicable)
            {
                return;
            }

            XElement xaction = Context.MCutTestRun.GetChessXActionMatchingStartOf(Text);

            Applicable &= xaction != null &&
                          Context.LastXSchedule != null
                          // Don't allow repro of a repro
                          && Context.MCutTestRun.RunType != MCutTestRunType.Repro
            ;
            if (!Applicable)
            {
                return;
            }

            // Need to add the last schedule from the TestRun
            var opts = new MChessOptions();

            opts.EnableRepro = true;
            opts.XSchedule   = Context.LastXSchedule;

            // Merge with existing options
            opts.MergeWith(MChessOptions);
            MChessOptions = opts;
        }
        /// <summary>
        /// Sets up the base <see cref="MChessOptions"/> instance for a fresh run of this test.
        /// This is the part that usually differentiate tests using MChess from each other.
        /// </summary>
        /// <returns></returns>
        public virtual void SetBaseMChessOptionsForTestExecution(AppTasks.RunMChessBasedTestTask runTestTask, MChessOptions opts)
        {
            // Look to see if the test defines an MChessOptions element
            var xopts = DataElement.Element(XChessNames.MChessOptions);

            if (xopts != null)
            {
                var testOpts = new MChessOptions(xopts);
                opts.MergeWith(testOpts);
            }
        }
Esempio n. 5
0
        protected override void OnBindToContext()
        {
            base.OnBindToContext();

            var prevRun = Context.MCutTestRun;

            if (prevRun != null)
            {
                // Incorporate the prev run's options in, while being overridden by the current options
                MChessOptions opts = new MChessOptions(prevRun.TestCase.XMChessOptions);
                opts.MergeWith(MChessOptions);
                MChessOptions = opts;
            }
        }
Esempio n. 6
0
        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);
        }