/// /// Copyright (c) 2019 Sensus Slovensko a.s. /// using System; using System.Collections.Generic; using log4net; using Common; using Config.Entities; using TBF.UiBridge; namespace TBF.Rig.TestMethods.Dummy { public class DummySeq : Sequences.SequenceBase { private static readonly ILog log = LogManager.GetLogger(typeof(DummySeq)); /// /// Adjustment method sequence /// /// Test entity /// /// Event.Done . . . . . . . OK /// Event.UiCmdStop . . . . Stopped by the user using the on-screen button STOP /// Event.OpArgumentError . Target flow is out of range /// Event.Error . . . . . . Unspecified error /// public IList Execute(Test test, int repetitionNr, bool isLastRepetition, DebugMode mode) { IList e = new List(); /// Events from currently running operations checkUiOp = new Operations.CheckUIOp(true); /// Runs in more then one state /// Start the test, initialize test results Bridge.OnTestSelected(this, new TestSelectedEventArgs(test, repetitionNr, inPath, benchPath, outPath, sensPath, heatMetersPath, 0)); string testName = Common.Utils.GetTestName(test.Name, test.Repeats, repetitionNr); TestStartTime = DateTime.Now; /// /// Show a dialog with OK button and an appropriate message /// Bridge.OnAdjustmentInProgress(this, new AdjustmentInProgressEventArgs(testName)); Bridge.OnTestProgress(this, new TestProgressEventArgs(test, repetitionNr, Progress.Test)); Bridge.OnActivity(this, test.Method); State.Create(string.Format("{0}({1}) : Dummy", test.Method, test.Name)) .AddOperation(checkUiOp) .AddOperation(StateMachine.BenchWaitingOp) .AddOperation(new Operations.MessageBoxOp(string.Format("Dummy test {0}", test.Name))) .EnterState(); do { e = StateMachine.WaitRunDevsRunOps(); Bridge.OnTestProgress(this, new TestProgressEventArgs(test, 1, Progress.Test)); if (e.Contains(Event.Error)) goto stopTest; if (TestAndLogUiCmdStop(test, e)) goto stopTest; } while (!e.Contains(Event.OK)); return new List { Event.Done }; stopTest: return new List { Event.UiCmdStop }; } } }