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); }
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); }