protected MoveOptions20 GetMoveOptions(string token, string stepName) { MoveOptions20 options = null; RunStep(() => { options = Client.GetMoveOptions(token); }, stepName); DoRequestDelay(); return(options); }
public Model( string profToken, string sourceToken, ImagingOptions20 options, MoveOptions20 moveOptions ) { this.profToken = profToken; this.sourceToken = sourceToken; this.options = options; this.moveOptions = moveOptions; }
internal StepType GetMoveOptionsTest(out MoveOptions20 target, out SoapException ex, out int Timeout, string VideoSourceToken) { StepType res = StepType.None; Timeout = 0; ex = null; bool passed = true; string logMessage = ""; //Get step list for command XmlNodeList m_testList = m_TestCommon.GetStepsForCommand("Imaging20.GetMoveOptions"); if (m_testList != null) { //Get current step XmlNode test = m_testList[m_commandCount[GetMoveOptions]]; #region Serialization Temp //Media.VideoEncoderConfigurationOptions dsr = new Media.VideoEncoderConfigurationOptions(); //dsr.JPEG = new Media.JpegOptions(); //XmlSerializer serializer = new XmlSerializer(typeof(Media.VideoEncoderConfigurationOptions)); //XmlReader sr = XmlReader.Create(new StringReader(test.SelectNodes("ResponseParameters")[0].InnerXml)); //TextWriter textWriter = new StreamWriter("c:\\2.txt"); //serializer.Serialize(textWriter, dsr); #endregion //Serialization Temp #region Analyze request //VideoSourceToken CommonCompare.StringCompare("RequestParameters/VideoSourceToken", "VideoSourceToken", VideoSourceToken, ref logMessage, ref passed, test); #endregion //Analyze request //Generate response object targetObj; res = m_TestCommon.GenerateResponseStepTypeNotVoid(test, out targetObj, out ex, out Timeout, typeof(MoveOptions20)); target = (MoveOptions20)targetObj; //Log message m_TestCommon.writeToLog(test, logMessage, passed); Increment(m_testList.Count, GetMoveOptions); } else { res = StepType.None; Timeout = 0; target = null; ex = null; res = StepType.None; } return(res); }
public void ImagingCommandContinuousMoveTest() { RunTest( () => { VideoSource[] sources = GetAndValidateVideoSources(); for (int i = 0; i < sources.Length; i++) { MoveOptions20 options = null; options = GetMoveOptions(sources[i].token); if (options != null) { ValidateMoveOptions(options); BeginStep(string.Format("Check if Continuous Move is supported for video source '{0}'", sources[i].token)); bool continuousSupported = (options.Continuous != null); if (continuousSupported) { LogStepEvent("Supported"); } else { LogStepEvent("Not supported"); } StepPassed(); if (continuousSupported) { float speed = options.Continuous.Speed.Average(); FocusMove focus = new FocusMove(); focus.Continuous = new ContinuousFocus(); focus.Continuous.Speed = speed; Move(sources[i].token, focus); bool stopSucceeded; Stop(sources[i].token, out stopSucceeded); if (!stopSucceeded) { double timeout = ((double)_operationDelay) / 1000; BeginStep(string.Format("Wait {0} seconds to allow the DUT to move focus", timeout.ToString("0.000"))); Sleep(_operationDelay); StepPassed(); } } } } }); }
public override void Move(string VideoSourceToken, Imaging.FocusMove Focus) { CheckActionSupported(); CheckSourceExists(VideoSourceToken); MoveOptions20 options = Storage.Instance.MoveOptions[VideoSourceToken]; if ((Focus.Absolute != null && Focus.Continuous != null) || (Focus.Absolute != null && Focus.Relative != null) || (Focus.Continuous != null && Focus.Relative != null)) { ThrowInvalidArgVal(); } if (Focus.Absolute != null) { if (Focus.Absolute.Position.NotIn(options.Absolute.Position)) { ThrowInvalidArgVal(); } if (Focus.Absolute.SpeedSpecified && Focus.Absolute.Speed.NotIn(options.Absolute.Speed)) { ThrowInvalidArgVal(); } } if (Focus.Continuous != null) { if (Focus.Continuous.Speed.NotIn(options.Continuous.Speed)) { ThrowInvalidArgVal(); } } if (Focus.Relative != null) { if (Focus.Relative.Distance.NotIn(options.Relative.Distance)) { ThrowInvalidArgVal(); } if (Focus.Relative.SpeedSpecified && Focus.Relative.Speed.NotIn(options.Relative.Speed)) { ThrowInvalidArgVal(); } } }
public void ImagingCommandContinuousMoveInvalidSettingsTest() { RunTest( () => { VideoSource[] sources = GetAndValidateVideoSources(); for (int i = 0; i < sources.Length; i++) { MoveOptions20 options = null; options = GetMoveOptions(sources[i].token); if (options != null) { ValidateMoveOptions(options); BeginStep(string.Format("Check if Continuous Move is supported for video source '{0}'", sources[i].token)); bool continuousSupported = (options.Continuous != null); if (continuousSupported) { LogStepEvent("Supported"); } else { LogStepEvent("Not supported"); } StepPassed(); if (continuousSupported) { float speed = options.Continuous.Speed.Max + 1; FocusMove focus = new FocusMove(); focus.Continuous = new ContinuousFocus(); focus.Continuous.Speed = speed; RunStep(() => { Client.Move(sources[i].token, focus); }, "Move - negative test (invalid Speed)", new ValidateTypeFault(ValidateInvalidMoveFault)); DoRequestDelay(); } } } }); }
public static Model Create( string profToken, string sourceToken, ImagingOptions20 options, ImagingSettings20 settings, MoveOptions20 moveOptions ) { var _this = new Model(); _this.profToken = profToken; _this.sourceToken = sourceToken; _this.options = options; _this.moveOptions = moveOptions; _this.origin.settings = settings; _this.RevertChanges(); return(_this); }
public void GetMoveOptionsTest() { RunTest( () => { VideoSource[] sources = GetAndValidateVideoSources(); for (int i = 0; i < sources.Length; i++) { MoveOptions20 options = null; options = GetMoveOptions(sources[i].token); if (options != null) { ValidateMoveOptions(options); } } }); }
public void GetMoveOptionsInvalidTokenTest() { RunTest( () => { VideoSource[] sources = GetAndValidateVideoSources(); string[] tokens = sources.Select(s => s.token).ToArray(); string invalidToken = tokens.GetNonMatchingString(); RunStep( () => { MoveOptions20 options = Client.GetMoveOptions(invalidToken); }, "Get options - negative test", new ValidateTypeFault(ValidateInvalidTokenFault)); DoRequestDelay(); }); }
public void ImagingCommandMoveUnsupportedMoveTest() { RunTest( () => { VideoSource[] sources = GetAndValidateVideoSources(); for (int i = 0; i < sources.Length; i++) { MoveOptions20 options = null; options = GetMoveOptions(sources[i].token); if (options != null) { ValidateMoveOptions(options); // absolute bool absoluteSupported; BeginStep(string.Format("Check if Absolute Move is supported for video source '{0}'", sources[i].token)); absoluteSupported = (options.Absolute != null); if (absoluteSupported) { LogStepEvent("Supported"); } else { LogStepEvent("Not supported"); } StepPassed(); if (!absoluteSupported) { FocusMove focus = new FocusMove(); focus.Absolute = new AbsoluteFocus(); focus.Absolute.Position = 1.0F; RunStep(() => { Client.Move(sources[i].token, focus); }, "Move - negative test (absolute not supported)", new ValidateTypeFault(ValidateInvalidMoveFault)); DoRequestDelay(); } // relative bool relativeSupported; BeginStep(string.Format("Check if Relative Move is supported for video source '{0}'", sources[i].token)); relativeSupported = (options.Relative != null); if (relativeSupported) { LogStepEvent("Supported"); } else { LogStepEvent("Not supported"); } StepPassed(); if (!relativeSupported) { FocusMove focus = new FocusMove(); focus.Relative = new RelativeFocus(); focus.Relative.Distance = 1.0F; RunStep(() => { Client.Move(sources[i].token, focus); }, "Move - negative test (relative not supported)", new ValidateTypeFault(ValidateInvalidMoveFault)); DoRequestDelay(); } // continuous BeginStep(string.Format("Check if Continuous Move is supported for video source '{0}'", sources[i].token)); bool continuousSupported = (options.Continuous != null); if (continuousSupported) { LogStepEvent("Supported"); } else { LogStepEvent("Not supported"); } StepPassed(); if (!continuousSupported) { FocusMove focus = new FocusMove(); focus.Continuous = new ContinuousFocus(); focus.Continuous.Speed = 1.0F; RunStep(() => { Client.Move(sources[i].token, focus); }, "Move - negative test (continuous not supported)", new ValidateTypeFault(ValidateInvalidMoveFault)); DoRequestDelay(); } } } }); }
public void ImagingCommandRelativeMoveInvalidSettingsTest() { RunTest( () => { VideoSource[] sources = GetAndValidateVideoSources(); for (int i = 0; i < sources.Length; i++) { MoveOptions20 options = null; options = GetMoveOptions(sources[i].token); if (options != null) { ValidateMoveOptions(options); bool relativeSupported; BeginStep(string.Format("Check if Relative Move is supported for video source '{0}'", sources[i].token)); relativeSupported = (options.Relative != null); if (relativeSupported) { LogStepEvent("Supported"); } else { LogStepEvent("Not supported"); } StepPassed(); if (relativeSupported) { float distance = options.Relative.Distance.Max + 1; FocusMove focus = new FocusMove(); focus.Relative = new RelativeFocus(); focus.Relative.Distance = distance; RunStep(() => { Client.Move(sources[i].token, focus); }, "Move - negative test (invalid Distance)", new ValidateTypeFault(ValidateInvalidMoveFault)); DoRequestDelay(); bool speedSupported; BeginStep(string.Format("Check if Relative Move Speed is supported for video source '{0}'", sources[i].token)); speedSupported = (options.Relative.Speed != null); if (speedSupported) { LogStepEvent("Supported"); } else { LogStepEvent("Not supported"); } StepPassed(); if (speedSupported) { focus.Relative.Distance = options.Relative.Distance.Average(); focus.Relative.SpeedSpecified = true; focus.Relative.Speed = options.Relative.Speed.Max + 1; RunStep(() => { Client.Move(sources[i].token, focus); }, "Move - negative test (invalid Speed)", new ValidateTypeFault(ValidateInvalidMoveFault)); DoRequestDelay(); } } } } }); }
public void ImagingCommandRelativeMoveTest() { RunTest( () => { VideoSource[] sources = GetAndValidateVideoSources(); for (int i = 0; i < sources.Length; i++) { MoveOptions20 options = null; options = GetMoveOptions(sources[i].token); if (options != null) { ValidateMoveOptions(options); bool relativeSupported; BeginStep(string.Format("Check if Relative Move is supported for video source '{0}'", sources[i].token)); relativeSupported = (options.Relative != null); if (relativeSupported) { LogStepEvent("Supported"); } else { LogStepEvent("Not supported"); } StepPassed(); if (relativeSupported) { float distance = options.Relative.Distance.Max / 2; FocusMove focus = new FocusMove(); focus.Relative = new RelativeFocus(); focus.Relative.Distance = distance; Move(sources[i].token, focus); bool speedSupported; BeginStep(string.Format("Check if Relative Move Speed is supported for video source '{0}'", sources[i].token)); speedSupported = (options.Relative.Speed != null); if (speedSupported) { LogStepEvent("Supported"); } else { LogStepEvent("Not supported"); } StepPassed(); if (speedSupported) { focus.Relative.Distance = options.Relative.Distance.Min / 2; focus.Relative.SpeedSpecified = true; focus.Relative.Speed = options.Relative.Speed.Average(); Move(sources[i].token, focus); } } } } }); }
public void ImagingCommandAbsoluteMoveTest() { RunTest( () => { VideoSource[] sources = GetAndValidateVideoSources(); for (int i = 0; i < sources.Length; i++) { MoveOptions20 options = null; options = GetMoveOptions(sources[i].token); if (options != null) { ValidateMoveOptions(options); bool absoluteSupported; BeginStep(string.Format("Check if Absolute Move is supported for video source '{0}'", sources[i].token)); absoluteSupported = (options.Absolute != null); if (absoluteSupported) { LogStepEvent("Supported"); } else { LogStepEvent("Not supported"); } StepPassed(); if (absoluteSupported) { float position = (2.0F * options.Absolute.Position.Min / 3.0F + options.Absolute.Position.Max / 3.0F); FocusMove focus = new FocusMove(); focus.Absolute = new AbsoluteFocus(); focus.Absolute.Position = position; Move(sources[i].token, focus); BeginStep(string.Format("Check if Absolute Move Speed is supported for video source '{0}'", sources[i].token)); bool supported = (options.Absolute.Speed != null); if (supported) { LogStepEvent("Supported"); } else { LogStepEvent("Not supported"); } StepPassed(); if (supported) { position = position = (options.Absolute.Position.Min / 3.0F + 2.0F * options.Absolute.Position.Max / 3.0F); focus.Absolute.Position = position; focus.Absolute.SpeedSpecified = true; focus.Absolute.Speed = options.Absolute.Speed.Average(); Move(sources[i].token, focus); } } } } }); }