Exemplo n.º 1
0
        /// <summary>
        /// Gives default implementation of bump test action with docking station, instrument with sensors, and gas end points
        /// Changes properties as you need for your testing
        /// </summary>
        internal static InstrumentDiagnosticAction GetDiagnosticAction(DeviceType deviceType, DeviceSubType subType = DeviceSubType.None)
        {
            InstrumentDiagnosticAction action = new InstrumentDiagnosticAction();

            action.DockingStation = GetDockingStationForTest(deviceType);
            action.Instrument     = GetInstrumentForTest(deviceType, subType);
            return(action);
        }
Exemplo n.º 2
0
 private void InitializeMocks(InstrumentDiagnosticAction diagAction)
 {
     instrumentController = MockHelper.GetInstrumentControllerMockForDiag(diagAction);
     switchServiceInt     = MockHelper.GetSwitchServiceMock(diagAction.Instrument, false, instrumentController.Object);
     controllerWrapper    = MockHelper.GetControllerMock(diagAction.DockingStation, diagAction.Instrument);
     consoleService       = MockHelper.GetConsoleServiceMock();
     pumpManager          = MockHelper.GetPumpMock();
     DiagErrorDataAccess  = MockHelper.GetDiagCriticalErrorsMock();
 }
Exemplo n.º 3
0
        private void InitializeForTest(InstrumentDiagnosticAction action)
        {
            InitializeMocks(action);

            Configuration.DockingStation = action.DockingStation;
            Configuration.Schema         = Helper.GetSchemaForTest();

            CreateMasterForMockTest();
        }
Exemplo n.º 4
0
        public void ExecuteGeneralDiag()
        {
            // arrange
            InstrumentDiagnosticAction action = Helper.GetDiagnosticAction(DeviceType.MX4);

            InitializeForTest(action);

            InstrumentDiagnosticOperation diagOperation = new InstrumentDiagnosticOperation(action);
            InstrumentDiagnosticEvent     diag          = (InstrumentDiagnosticEvent)diagOperation.Execute();

            Assert.True(diag.Diagnostics.Count == 2);

            instrumentController.Verify(x => x.ClearInstrumentErrors(), Times.Once);
        }
Exemplo n.º 5
0
        public void GetNothingActionDueToInstrumentCriticalError()
        {
            // arrange
            InstrumentDiagnosticAction    action    = new InstrumentDiagnosticAction();
            InstrumentDiagnosticOperation operation = new InstrumentDiagnosticOperation(action);
            InstrumentDiagnosticEvent     dsEvent   = new InstrumentDiagnosticEvent(operation);

            instrument = Helper.GetInstrumentForTest(DeviceType.VPRO, DeviceSubType.VentisPro4);
            dsEvent.InstrumentInCriticalError = true;

            Initialize();
            CreateMasterForTest();
            // act
            nextAction = scheduler.GetNextAction(dsEvent);

            // assert
            Xunit.Assert.True(nextAction is NothingAction);
        }
Exemplo n.º 6
0
        public void ExecuteDiagnosticsForMX6InstrumentErrorsOnCustomerAccount()
        {
            // arrange
            InstrumentDiagnosticAction action = Helper.GetDiagnosticAction(DeviceType.MX6);

            InitializeForTest(action);

            InstrumentDiagnosticOperation diagOperation = new InstrumentDiagnosticOperation(action);

            diagOperation.criticalErrorsList = DiagErrorDataAccess.Object.FindAll();

            InstrumentDiagnosticEvent diag = (InstrumentDiagnosticEvent)diagOperation.Execute();

            Assert.True(diag.Diagnostics.Count == 2 && diag.InstrumentInCriticalError &&
                        diag.InstrumentCriticalErrorCode == diagOperation.criticalErrorsList[0].Code.ToString());

            instrumentController.Verify(x => x.ClearInstrumentErrors(), Times.Never);
        }
 /// <summary>
 /// Creates an instance of a generic InstrumentDiagnosticOperation object.
 /// </summary>
 public InstrumentDiagnosticOperation(InstrumentDiagnosticAction instrumentDiagnosticAction) : base(instrumentDiagnosticAction)
 {
 }
Exemplo n.º 8
0
        internal static Mock <InstrumentController> GetInstrumentControllerMockForDiag(InstrumentDiagnosticAction diagAction)
        {
            Mock <InstrumentController> instrumentController = new Mock <InstrumentController>();

            instrumentController.Setup(x => x.Initialize(It.IsAny <InstrumentController.Mode>()));
            instrumentController.Setup(x => x.EnablePump(false));
            instrumentController.Setup(x => x.GetGeneralDiagnosticProperties()).Returns(new GeneralDiagnosticProperty[] { new GeneralDiagnosticProperty("PUMP", "FINE") });
            instrumentController.Setup(x => x.GetInstrumentErrors()).Returns(new ErrorDiagnostic[] { new ErrorDiagnostic(3850, DateTime.UtcNow, ErrorCategory.Instrument, string.Empty) });
            instrumentController.Setup(x => x.ClearInstrumentErrors());

            return(instrumentController);
        }