public void ExecuteDatalogDownloadAndDownloadDatalogDetailsFromInstrument() { // arrange InstrumentDatalogDownloadAction action = Helper.GetDatalogDownloadAction(DeviceType.MX6); InitializeForTest(action); instrumentController.Setup(x => x.GetDatalog(out corruptDatalogDetected)) .Returns(new List <DatalogSession> { new DatalogSession() { BaseUnitSerialNumber = string.Empty, Comments = string.Empty, RecordingInterval = 60, SerialNumber = action.Instrument.SerialNumber, SessionNumber = 1, TWATimeBase = 10 , User = string.Empty, Session = DateTime.Now , SensorSessions = new List <DatalogSensorSession>() { new DatalogSensorSession("SENSORTST123", new ComponentType(SensorCode.O2)) } } }); InstrumentDatalogDownloadOperation datalogDownloadOperation = new InstrumentDatalogDownloadOperation(action); InstrumentDatalogDownloadEvent datalogDownloadEvent = (InstrumentDatalogDownloadEvent)datalogDownloadOperation.Execute(); Assert.True(datalogDownloadEvent.InstrumentSessions.Count == 1); }
internal static InstrumentDatalogDownloadAction GetDatalogDownloadAction(DeviceType deviceType, DeviceSubType subType = DeviceSubType.None) { InstrumentDatalogDownloadAction action = new InstrumentDatalogDownloadAction(); action.DockingStation = GetDockingStationForTest(deviceType); action.Instrument = GetInstrumentForTest(deviceType, subType); return(action); }
private void InitializeForTest(InstrumentDatalogDownloadAction action) { InitializeMocks(action); Configuration.DockingStation = action.DockingStation; Configuration.Schema = Helper.GetSchemaForTest(); CreateMasterForMockTest(); }
public void ExecuteDatalogDownload() { // arrange InstrumentDatalogDownloadAction action = Helper.GetDatalogDownloadAction(DeviceType.MX4); InitializeForTest(action); InstrumentDatalogDownloadOperation datalogDownloadOperation = new InstrumentDatalogDownloadOperation(action); InstrumentDatalogDownloadEvent datalogDownloadEvent = (InstrumentDatalogDownloadEvent)datalogDownloadOperation.Execute(); Assert.True(datalogDownloadEvent.InstrumentSessions.Count == 0); }
public void ExecuteCorruptDatalogDownload() { // arrange InstrumentDatalogDownloadAction action = Helper.GetDatalogDownloadAction(DeviceType.MX6); InitializeForTest(action); DateTime sessionTime = DateTime.Now; instrumentController.Setup(x => x.GetDatalog(out corruptDatalogDetected)) .Returns(new List <DatalogSession> { new DatalogSession() { BaseUnitSerialNumber = string.Empty, Comments = string.Empty, RecordingInterval = 60, SerialNumber = action.Instrument.SerialNumber, SessionNumber = 1, TWATimeBase = 10 , User = string.Empty, Session = sessionTime, CorruptionException = new Exception("Corrupt Datalog Exception") , SensorSessions = new List <DatalogSensorSession>() { new DatalogSensorSession("SENSORTST123", new ComponentType(SensorCode.O2)) } } }); InstrumentDatalogDownloadOperation datalogDownloadOperation = new InstrumentDatalogDownloadOperation(action); InstrumentDatalogDownloadEvent datalogDownloadEvent = (InstrumentDatalogDownloadEvent)datalogDownloadOperation.Execute(); Assert.True(datalogDownloadEvent.InstrumentSessions.Count == 1 && datalogDownloadEvent.InstrumentSessions[0].BaseUnitSerialNumber == string.Empty && datalogDownloadEvent.InstrumentSessions[0].Comments == string.Empty && datalogDownloadEvent.InstrumentSessions[0].RecordingInterval == 60 && datalogDownloadEvent.InstrumentSessions[0].SerialNumber == action.Instrument.SerialNumber && datalogDownloadEvent.InstrumentSessions[0].SessionNumber == 1 && datalogDownloadEvent.InstrumentSessions[0].TWATimeBase == 10 && datalogDownloadEvent.InstrumentSessions[0].User == string.Empty && datalogDownloadEvent.InstrumentSessions[0].Session == sessionTime && datalogDownloadEvent.InstrumentSessions[0].CorruptionException.Message == "Corrupt Datalog Exception"); }
public InstrumentDatalogDownloadOperation( InstrumentDatalogDownloadAction instrumentDatalogDownloadAction ) : base( instrumentDatalogDownloadAction ) { Init(); }
private void InitializeMocks(InstrumentDatalogDownloadAction datalogAction) { instrumentController = MockHelper.GetInstrumentControllerMock(); switchServiceInt = MockHelper.GetSwitchServiceMock(datalogAction.Instrument, false, instrumentController.Object); controllerWrapper = MockHelper.GetControllerMock(datalogAction.DockingStation, datalogAction.Instrument); }