public void GetCalibrationActionIfNoJournalsExists() { // arrange instrument = Helper.GetInstrumentForTest(DeviceType.VPRO, DeviceSubType.VentisPro4); List <InstalledComponent> installedComponents = Helper.GetSensorsForTest(new List <string>() { GasCode.CO, GasCode.H2S, GasCode.O2, GasCode.CombustibleLEL }); instrument.InstalledComponents.AddRange(installedComponents); dockingStation = Helper.GetDockingStationForTest(DeviceType.MX4); InstrumentManualOperationsClearAction action = new InstrumentManualOperationsClearAction(); InstrumentManualOperationsClearOperation operation = new InstrumentManualOperationsClearOperation(action); List <EventJournal> eventJournals = new List <EventJournal>(); eventJournals.Add(new EventJournal(EventCode.GetCachedCode(EventCode.InstrumentDiagnostics), instrument.SerialNumber, DateTime.Now.AddMonths(-1), DateTime.Now.AddMonths(-1), true, instrument.SoftwareVersion)); _eventJournalDataAccess.Setup(x => x.FindBySerialNumbers(It.IsAny <string[]>(), It.IsAny <IDataAccessTransaction>())).Returns(eventJournals); _eventJournalDataAccess.Setup(x => x.FindLastEventByInstrumentSerialNumber(It.IsAny <string>(), It.IsAny <string>(), It.IsAny <IDataAccessTransaction>())).Returns(eventJournals); Initialize(); // act schema.Setup(x => x.Activated).Returns(true); dsEvent = new InstrumentManualOperationsClearEvent(operation); CreateMasterForTest(); nextAction = scheduler.GetNextAction(dsEvent); // assert Xunit.Assert.True(nextAction is InstrumentCalibrationAction); }
private void InitializeForTest(InstrumentManualOperationsClearAction action) { InitializeMocks(action); Configuration.DockingStation = action.DockingStation; Configuration.Schema = Helper.GetSchemaForTest(); CreateMasterForMockTest(); }
internal static InstrumentManualOperationsClearAction GetManualOperationsClearAction(DeviceType deviceType, DeviceSubType subType = DeviceSubType.None) { InstrumentManualOperationsClearAction action = new InstrumentManualOperationsClearAction(); action.DockingStation = GetDockingStationForTest(deviceType); action.Instrument = GetInstrumentForTest(deviceType, subType); return(action); }
public void ClearManualGasOperations() { // arrange InstrumentManualOperationsClearAction action = Helper.GetManualOperationsClearAction(DeviceType.MX4); InitializeForTest(action); instrumentController.Setup(x => x.ClearManualGasOperations()); InstrumentManualOperationsClearOperation manualOperationsClearOperation = new InstrumentManualOperationsClearOperation(action); InstrumentManualOperationsClearEvent manualOperationsClearEvent = (InstrumentManualOperationsClearEvent)manualOperationsClearOperation.Execute(); instrumentController.Verify(x => x.ClearManualGasOperations(), Times.Once); }
public InstrumentManualOperationsClearOperation(InstrumentManualOperationsClearAction instrumentManualOperationsClearAction) : base(instrumentManualOperationsClearAction) { }
private void InitializeMocks(InstrumentManualOperationsClearAction manualOperationsClearAction) { instrumentController = MockHelper.GetInstrumentControllerMock(); switchServiceInt = MockHelper.GetSwitchServiceMock(manualOperationsClearAction.Instrument, false, instrumentController.Object); controllerWrapper = MockHelper.GetControllerMock(manualOperationsClearAction.DockingStation, manualOperationsClearAction.Instrument); }