public void ReturnManualBumpTestRequiredActionForInstrumentWithBumpFailedSensor() { // arrange InstrumentBumpTestAction action = Helper.GetBumpTestAction(DeviceType.VPRO, new List <string>() { GasCode.CO, GasCode.H2S, GasCode.O3 }, DeviceSubType.VentisPro4); foreach (InstalledComponent installedComponent in action.Instrument.InstalledComponents.Where(comp => comp.Component is Sensor)) { Sensor sensor = installedComponent.Component as Sensor; sensor.BumpTestStatus = false; } instrument = action.Instrument; Initialize(); CreateMasterForTest(); // act InstrumentBumpTestOperation operation = new InstrumentBumpTestOperation(action); dsEvent = new InstrumentBumpTestEvent(operation); nextAction = scheduler.GetNextAction(dsEvent); // assert Xunit.Assert.True(nextAction is ManualBumpTestRequiredAction); }
public void ShouldThrowNotSupportedException() { //Arrange InstrumentBumpTestAction action = new InstrumentBumpTestAction(); action.DockingStation = new DockingStation(); action.Instrument = new Instrument(); Configuration.DockingStation = action.DockingStation; //Act and Assert Xunit.Assert.Throws <NotSupportedException>(() => new InstrumentBumpTestOperation(action)); }
/// <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 InstrumentBumpTestAction GetBumpTestAction(DeviceType deviceType, List <string> gasCodes = null, DeviceSubType subType = DeviceSubType.None) { //It is not expected that user would pass gas codes. If not passed in, create empty list. if (gasCodes == null) { gasCodes = new List <string>(); } InstrumentBumpTestAction action = new InstrumentBumpTestAction(); action.DockingStation = GetDockingStationForTest(deviceType); action.Instrument = GetInstrumentForTest(deviceType, subType); action.Instrument.InstalledComponents.AddRange(GetSensorsForTest(gasCodes)); action.GasEndPoints = GetGasEndPointsForTest(action.Instrument.InstalledComponents); return(action); }
public void ShouldPassMx6InstrumentWithDefaultSensors() { //This test is not passing currentlly because of improper gasendpoints. //Arrange InstrumentBumpTestAction action = Helper.GetBumpTestAction(DeviceType.MX6, new List <string> { "G0001", "G0002", "G0020" }); Configuration.DockingStation = action.DockingStation; //Act InstrumentBumpTestOperation operation = new InstrumentBumpTestOperation(action); InstrumentBumpTestEvent returnEvent = operation.Execute() as InstrumentBumpTestEvent; //Assert that all default sensors passed bump test Xunit.Assert.NotNull(returnEvent); Xunit.Assert.True(returnEvent.GasResponses[0].Passed); Xunit.Assert.True(returnEvent.GasResponses[1].Passed); Xunit.Assert.True(returnEvent.GasResponses[2].Passed); Xunit.Assert.True(returnEvent.GasResponses[3].Passed); }
public InstrumentBumpTestOperation(InstrumentBumpTestAction instrumentBumpTestAction) : base(instrumentBumpTestAction) { Init(); }
internal static Mock <InstrumentController> GetInstrumentControllerMockForBump(InstrumentBumpTestAction action) { Mock <InstrumentController> instrumentController = new Mock <InstrumentController>(); instrumentController.Setup(x => x.Initialize(It.IsAny <InstrumentController.Mode>())); instrumentController.Setup(x => x.GetSensorMaximumReading(It.IsAny <int>(), It.IsAny <double>())).Returns(30); // Can be any valid number instrumentController.Setup(x => x.GetSensorBumpFlowRate(It.IsAny <InstalledComponent>())).Returns(Pump.StandardFlowRate); instrumentController.Setup(x => x.GetSensorBiasStatus()).Returns(true); instrumentController.Setup(x => x.BeginInstrumentBump()); instrumentController.Setup(x => x.BeginSensorBump(It.IsAny <int>())); instrumentController.Setup(x => x.PauseGasFlow(It.IsAny <GasEndPoint>(), It.IsAny <long>())); instrumentController.Setup(x => x.EndInstrumentBump()); instrumentController.Setup(x => x.SetSensorBumpFault(It.IsAny <int>(), It.IsAny <bool>())); instrumentController.Setup(x => x.EnablePump(false)); instrumentController.Setup(x => x.OpenGasEndPoint(action.GasEndPoints[1], 500)); instrumentController.Setup(x => x.GetSensorLowAlarm(It.IsAny <int>(), It.IsAny <double>())).Returns(0.2); // To Pass pre bump Purge instrumentController.SetupSequence(x => x.GetSensorReading(It.IsAny <int>(), It.IsAny <double>())).Returns(0); instrumentController.Setup(x => x.GetSensorSpanCoeff(It.IsAny <int>())).Returns(12.5); return(instrumentController); }