/// <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 InstrumentDiagnosticAction GetDiagnosticAction(DeviceType deviceType, DeviceSubType subType = DeviceSubType.None) { InstrumentDiagnosticAction action = new InstrumentDiagnosticAction(); action.DockingStation = GetDockingStationForTest(deviceType); action.Instrument = GetInstrumentForTest(deviceType, subType); return(action); }
private void InitializeMocks(InstrumentDiagnosticAction diagAction) { instrumentController = MockHelper.GetInstrumentControllerMockForDiag(diagAction); switchServiceInt = MockHelper.GetSwitchServiceMock(diagAction.Instrument, false, instrumentController.Object); controllerWrapper = MockHelper.GetControllerMock(diagAction.DockingStation, diagAction.Instrument); consoleService = MockHelper.GetConsoleServiceMock(); pumpManager = MockHelper.GetPumpMock(); DiagErrorDataAccess = MockHelper.GetDiagCriticalErrorsMock(); }
private void InitializeForTest(InstrumentDiagnosticAction action) { InitializeMocks(action); Configuration.DockingStation = action.DockingStation; Configuration.Schema = Helper.GetSchemaForTest(); CreateMasterForMockTest(); }
public void ExecuteGeneralDiag() { // arrange InstrumentDiagnosticAction action = Helper.GetDiagnosticAction(DeviceType.MX4); InitializeForTest(action); InstrumentDiagnosticOperation diagOperation = new InstrumentDiagnosticOperation(action); InstrumentDiagnosticEvent diag = (InstrumentDiagnosticEvent)diagOperation.Execute(); Assert.True(diag.Diagnostics.Count == 2); instrumentController.Verify(x => x.ClearInstrumentErrors(), Times.Once); }
public void GetNothingActionDueToInstrumentCriticalError() { // arrange InstrumentDiagnosticAction action = new InstrumentDiagnosticAction(); InstrumentDiagnosticOperation operation = new InstrumentDiagnosticOperation(action); InstrumentDiagnosticEvent dsEvent = new InstrumentDiagnosticEvent(operation); instrument = Helper.GetInstrumentForTest(DeviceType.VPRO, DeviceSubType.VentisPro4); dsEvent.InstrumentInCriticalError = true; Initialize(); CreateMasterForTest(); // act nextAction = scheduler.GetNextAction(dsEvent); // assert Xunit.Assert.True(nextAction is NothingAction); }
public void ExecuteDiagnosticsForMX6InstrumentErrorsOnCustomerAccount() { // arrange InstrumentDiagnosticAction action = Helper.GetDiagnosticAction(DeviceType.MX6); InitializeForTest(action); InstrumentDiagnosticOperation diagOperation = new InstrumentDiagnosticOperation(action); diagOperation.criticalErrorsList = DiagErrorDataAccess.Object.FindAll(); InstrumentDiagnosticEvent diag = (InstrumentDiagnosticEvent)diagOperation.Execute(); Assert.True(diag.Diagnostics.Count == 2 && diag.InstrumentInCriticalError && diag.InstrumentCriticalErrorCode == diagOperation.criticalErrorsList[0].Code.ToString()); instrumentController.Verify(x => x.ClearInstrumentErrors(), Times.Never); }
/// <summary> /// Creates an instance of a generic InstrumentDiagnosticOperation object. /// </summary> public InstrumentDiagnosticOperation(InstrumentDiagnosticAction instrumentDiagnosticAction) : base(instrumentDiagnosticAction) { }
internal static Mock <InstrumentController> GetInstrumentControllerMockForDiag(InstrumentDiagnosticAction diagAction) { Mock <InstrumentController> instrumentController = new Mock <InstrumentController>(); instrumentController.Setup(x => x.Initialize(It.IsAny <InstrumentController.Mode>())); instrumentController.Setup(x => x.EnablePump(false)); instrumentController.Setup(x => x.GetGeneralDiagnosticProperties()).Returns(new GeneralDiagnosticProperty[] { new GeneralDiagnosticProperty("PUMP", "FINE") }); instrumentController.Setup(x => x.GetInstrumentErrors()).Returns(new ErrorDiagnostic[] { new ErrorDiagnostic(3850, DateTime.UtcNow, ErrorCategory.Instrument, string.Empty) }); instrumentController.Setup(x => x.ClearInstrumentErrors()); return(instrumentController); }