Ejemplo n.º 1
0
        public void TestMethodResourceSettingNullReference()
        {
            TestTraceListener tapTraceListener = new TestTraceListener();
            DummyDut          device           = new DummyDut();

            try
            {
                Log.AddListener(tapTraceListener);
                DutSettings.Current.Add(device);

                // this works
                var testPlan = new TestPlan();
                var step     = new DummyInstrumentAndDutStep()
                {
                    Device = device, Instrument = null
                };
                testPlan.ChildTestSteps.Add(step);
                var run = testPlan.Execute();

                Assert.AreEqual(Verdict.Error, run.Verdict);
                tapTraceListener.ExpectWarnings("TestPlan aborted.");
                tapTraceListener.ExpectErrors(
                    $"Resource setting {nameof(DummyInstrumentAndDutStep.Instrument)} not set on step {nameof(DummyInstrumentAndDutStep)}. Please configure or disable step.");
            }
            finally
            {
                tapTraceListener.Flush();
                Log.RemoveListener(tapTraceListener);
                DutSettings.Current.Remove(device);
            }
        }