public void InstrumentRequiresOperatorAction()
        {
            // arrange
            SettingsReadOperation operation = new SettingsReadOperation();

            dsEvent = new SettingsReadEvent(operation);

            dockingStation = Helper.GetDockingStationForTest(DeviceType.MX4);
            instrument     = Helper.GetInstrumentForTest(DeviceType.VPRO, DeviceSubType.VentisPro4);

            Initialize();

            Sensor sensor = new Sensor();

            sensor.Enabled           = true;
            sensor.CalibrationStatus = Status.Failed;
            sensor.Type.Code         = SensorCode.O3;

            InstalledComponent installedComponent = new InstalledComponent();

            installedComponent.Position  = 1;
            installedComponent.Component = sensor;
            instrument.InstalledComponents.Add(installedComponent);

            Configuration.DockingStation = dockingStation;

            CreateMasterForTest();

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

            // assert
            Xunit.Assert.True(nextAction is ManualCalibrationRequiredAction);
        }
        public void DSXNotSynchronized()
        {
            // arrange
            SettingsReadOperation operation = new SettingsReadOperation();

            dsEvent = new SettingsReadEvent(operation);

            Mock <Schema> schema = new Mock <Schema>();

            schema.Setup(x => x.Synchronized).Returns(false);
            Configuration.Schema = schema.Object;

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

            // assert
            Xunit.Assert.True(nextAction is NothingAction);
        }
        public void InstrumentInSystemAlarm()
        {
            // arrange
            SettingsReadOperation operation = new SettingsReadOperation();

            dsEvent        = new SettingsReadEvent(operation);
            instrument     = Helper.GetInstrumentForTest(DeviceType.VPRO, DeviceSubType.VentisPro4);
            dockingStation = Helper.GetDockingStationForTest(DeviceType.MX4);
            Initialize();

            Configuration.DockingStation = dockingStation;

            switchService.Setup(x => x.IsInstrumentInSystemAlarm).Returns(true);

            CreateMasterForTest();

            // act and assert
            Xunit.Assert.Throws <InstrumentSystemAlarmException>(() => scheduler.GetNextAction(dsEvent));
        }
        public void GetNextForcedAction()
        {
            // arrange
            SettingsReadOperation operation = new SettingsReadOperation();

            dsEvent = new SettingsReadEvent(operation);

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

            Initialize();

            // ScheduledNow nowSched = new ScheduledNow(DomainModelConstant.NullId, DomainModelConstant.NullId, string.Empty, EventCode.GetCachedCode(EventCode.Calibration), null, null, true);
            CreateMasterForTest();
            // act
            scheduler.ForceEvent(EventCode.Calibration, false);
            nextAction = scheduler.GetNextAction(dsEvent);

            // assert
            Xunit.Assert.True(nextAction is InstrumentCalibrationAction);
        }