public StepName(StepType stepType, string name, IEnumerable<KeyValuePair<string, object>> substitutionParameters = null) { StepType = stepType; SeparatorToken = GetSeparatorToken(stepType, name); Outline = GetOutline(stepType, name); PrettyName = SubstituteParameters(Outline, substitutionParameters); }
public DebugResponse(string roomID, List<int> breakpoints, StepType step, bool action) { RoomID = roomID; Breakpoints = breakpoints; Step = step; Action = action; }
public static SemanticVersion Increment(this SemanticVersion target, StepType stepType) { switch (stepType) { case StepType.Major: return new SemanticVersion { Major = target.Major + 1, Minor = 0, Patch = 0 }; case StepType.Minor: return new SemanticVersion { Major = target.Major, Minor = target.Minor + 1, Patch = 0 }; case StepType.Patch: return new SemanticVersion { Major = target.Major, Minor = target.Minor, Patch = target.Patch + 1 }; default: throw new Exception("Unknown StepType: " + stepType); } }
protected BaseStep(bool runOnce, int stepOrder, StepType type, Stream sourceStream = null) { RunOnce = runOnce; StepOrder = stepOrder; Type = type; SourceStream = sourceStream; }
private string ProcessStepLine(string stepLine, StepType stepType) { string str = stepLine; var stepToken = stepType.ToString(); const string andToken = "And"; if (str.StartsWith(andToken, StringComparison.InvariantCultureIgnoreCase)) { str = str.Substring(andToken.Length); stepToken = andToken; } const string butToken = "But"; if (str.StartsWith(butToken, StringComparison.InvariantCultureIgnoreCase)) { str = str.Substring(butToken.Length); stepToken = butToken; } if (str.StartsWith(stepToken, StringComparison.InvariantCultureIgnoreCase)) { str = str.Substring(stepToken.Length); } str = Sanitize(str); return string.Format("{0}_{1}", stepToken, str); }
public MapReduceStep(LambdaExpression Expression, StepType type) { this.Expression = Expression; this.Type = type; Throw.If(this.InputType.GetGenericTypeDefinition() != typeof(KeyValuePair<,>), this.InputType.Name + " is not a key value pair"); Throw.If(this.OutputType.GetGenericTypeDefinition() != typeof(KeyValuePair<,>), this.OutputType.Name + " is not a key value pair"); }
bool IDebuggable.CanStep(StepType type) { if (_selectedDebuggable == null) { SetDefaultDebuggable(); } return _selectedDebuggable.CanStep(type); }
void IDebuggable.Step(StepType type) { if (_selectedDebuggable == null) { SetDefaultDebuggable(); } _selectedDebuggable.Step(type); }
private void ProcessScenarioLine(ScenarioStyle style, string line, ref StepType stepType, StringBuilder builder) { if (stepType == StepType.When) { stepType = StepType.Then; } if (line.StartsWith("When")) { stepType = StepType.When; } const string tagToken = "@"; if (line.StartsWith(tagToken)) { var tags = line.Split('@'); foreach (var tag in tags .Select(t => t.Trim().Trim('@')) .Where(t => !string.IsNullOrWhiteSpace(t))) { builder.AppendLine($" [Tag(\"{tag}\")]"); } return; } const string scenarioToken = "Scenario:"; if (line.StartsWith(scenarioToken)) { if (style == ScenarioStyle.Classic) builder.AppendLine(" [Scenario(Feature.Unknown)]"); string className = Sanitize(line.Substring(scenarioToken.Length)); builder.AppendLine($" public class {className} : {GetScenarioTypeName(style)}"); builder.AppendLine(" {"); if (style == ScenarioStyle.Fluent) { builder.AppendLine($" public {className}()"); builder.AppendLine(" {"); builder.AppendLine(" TODO"); builder.AppendLine(" }"); builder.AppendLine(); } return; } if (line.StartsWith("-> done: ")) { return; } var methodName = ProcessStepLine(line, stepType); if (style == ScenarioStyle.Classic) builder.AppendLine($" [{stepType}]"); builder.AppendLine($" {GetAccessModifierForStep(style)}void {methodName}()"); builder.AppendLine(" {"); builder.AppendLine(" }"); builder.AppendLine(); }
public void GetStepType(string clause, StepType expected, StepType actual) { "Given a string starts with '{0}'" .Given(() => clause = clause + " foo"); "When GetStepType() is called" .When(() => actual = StringExtensions.GetStepType(clause)); "Then StepType.{1} is returned" .Then(() => actual.Should().Be(expected)); }
public StepMethodInvoker(StepType stepType, MethodBase method, KeyValuePair<string, object>[] supportedParameters = null) { Method = method; Type = stepType; Parameters = method.BindParameters(supportedParameters); Name = new StepName(Type, method.Name, supportedParameters); ExceptionExpected = method.AttributeOrDefault<ThrowsAttribute>() != null; SourceDescription = string.Format("{0}.{1}", method.DeclaringType.FullName, method.Name); }
public BaseMovement(Transform transform, float speed, StepType step, bool terrestrial, Vector3? offset) { this.transform = transform; this.speed = speed; this.step = step; this.terrestrial = terrestrial; this.offset = offset == null ? Vector3.zero : (Vector3) offset; this.phase = 1; // Movement start ended }
public StepClassInvoker(StepType stepType, Type stepClass, KeyValuePair<string,object>[] supportedParameters, IExceptionHandler exceptionHandler) { if (!typeof(Step).IsAssignableFrom(stepClass)) throw new ArgumentException("The stepClass must inherit from Step", "stepClass"); _stepClass = stepClass; _exceptionHandler = exceptionHandler; Type = stepType; Name = new StepName(Type, _stepClass.Name, supportedParameters); Parameters = _stepClass.GetConstructors().Single().BindParameters(supportedParameters); }
public static void GetStepType(string clause, StepType expected, StepType actual) { "Given a string starts with '{0}'" .Given(() => clause = clause + " foo"); "When getting the step type" .When(() => actual = StringExtensions.GetStepType(clause)); "Then the step type is '{1}'" .Then(() => actual.Should().Be(expected)); }
bool IDebuggable.CanStep(StepType type) { switch (type) { case StepType.Into: case StepType.Over: case StepType.Out: return DebuggerStep != null; default: return false; } }
public bool CanStep(StepType type) { switch (type) { case StepType.Into: case StepType.Over: case StepType.Out: return true; default: return false; } }
public string GetStep(StepType stepType) { switch (stepType) { case StepType.Given: return _settings.Given; case StepType.When: return _settings.When; case StepType.Then: return _settings.Then; default: throw new NotSupportedException(string.Format("Unknown step type: {0}", stepType)); } }
void IDebuggable.Step(StepType type) { switch (type) { case StepType.Into: StepInto(); break; case StepType.Out: StepOut(); break; case StepType.Over: StepOver(); break; } }
public void Step(StepType type) { switch (type) { case StepType.Into: StepInto(); break; case StepType.Out: StepOut(); break; case StepType.Over: StepOver(); break; } }
private string GetOutline(StepType stepType, string name) { var stepNameSansStepType = GetStepNameWithoutTypeNorSeperators(stepType, name); if (string.IsNullOrWhiteSpace(stepNameSansStepType)) { // no conversion to _ or PascalCase necessary -- bail return string.Empty; } var outline = stepNameSansStepType.AsSentence(); return outline.StartsWithMultipleUppercaseLetters() ? outline : outline.WithFirstLetterLowercase(); }
public ActionStepMethod(MethodInfo info, StepAttribute attribute) { if (attribute is GivenAttribute) { stepType = StepType.Given; } if (attribute is WhenAttribute) { stepType = StepType.When; } if (attribute is ThenAttribute) { stepType = StepType.Then; } text = attribute.Text; methodInfo = info; }
public static SemanticVersion Decrement(this SemanticVersion target, StepType stepType) { switch (stepType) { case StepType.Major: if (target.Major == 0) { throw new WeavingException($"Can not derive `TreatAsErrorFromVersion` from '{target}' since Major is 0."); } return new SemanticVersion { Major = target.Major -1, Minor = 0, Patch = 0 }; case StepType.Minor: if (target.Minor == 0) { throw new WeavingException($"Can not derive `TreatAsErrorFromVersion` from '{target}' since Minor is 0."); } return new SemanticVersion { Major = target.Major, Minor = target.Minor - 1, Patch = 0 }; case StepType.Patch: if (target.Patch == 0) { throw new WeavingException($"Can not derive `TreatAsErrorFromVersion` from '{target}' since Patch is 0."); } return new SemanticVersion { Major = target.Major, Minor = target.Minor, Patch = target.Patch - 1 }; default: throw new Exception("Unknown StepType: " + stepType); } }
private void ProcessScenarioLine(string line, ref StepType stepType, StringBuilder builder) { if (stepType == StepType.When) { stepType = StepType.Then; } if (line.StartsWith("When")) { stepType = StepType.When; } const string tagToken = "@"; if (line.StartsWith(tagToken)) { builder.AppendLine(string.Format(" [Tag(\"{0}\")]", line.TrimStart('@'))); return; } const string scenarioToken = "Scenario:"; if (line.StartsWith(scenarioToken)) { builder.AppendLine(" [Scenario(Feature.Unknown)]"); builder.AppendLine(string.Format(" class {0} : Test", Sanitize(line.Substring(scenarioToken.Length)))); builder.AppendLine(" {"); return; } if (line.StartsWith("-> done: ")) { return; } var methodName = ProcessStepLine(line, stepType); builder.AppendLine(string.Format(" [{0}]", stepType)); builder.AppendLine(string.Format(" public void {0}()", methodName)); builder.AppendLine(" {"); builder.AppendLine(" }"); builder.AppendLine(); }
public ConfigurationStep(string description, InteractiveService interactive, SocketCommandContext context, StepType type, ConfigurationStep parent) { this.Interactive = interactive; this.description = description; Context = context; _criterion = new ReactionSameUserCriterion(); this.type = type; this.parent = parent; if (type == StepType.Reaction) { var abortAction = new ReactionAction(new Emoji("🆘")); abortAction.Action = (ConfigurationStep a) => { a.Result = null; return(Task.CompletedTask); }; this.Actions.Add(abortAction); } }
internal NotificationMessageHolderType[] PullMessagesTest(ParametersValidation validationRequest, out StepType stepType, out SoapException exc, out int timeout) { int special; int timeDiff; Dictionary <string, string> prefixes; NotificationMessageHolderType[] result; timeDiff = Convert.ToInt32(TakeSpecialParameterSimple <string>("PullMessages", PullMessages, "TimeShift")); prefixes = TakePrefixes("PullMessages", PullMessages); result = GetCommand <NotificationMessageHolderType[]>("PullMessages", PullMessages, validationRequest, true, out stepType, out exc, out timeout, out special); switch (special) { case 1: if (result.Count() != 0) { result[0].Message.Attributes["UtcTime"].Value = XmlConvert.ToString(System.DateTime.UtcNow.AddSeconds(timeDiff), XmlDateTimeSerializationMode.Utc); } break; default: break; } foreach (NotificationMessageHolderType notification in result) { if (notification.Xmlns == null) { notification.Xmlns = new XmlSerializerNamespaces(); } foreach (string prefix in prefixes.Keys) { notification.Xmlns.Add(prefix, prefixes[prefix]); } } return(result); }
public bool CanStep(StepType type) => false;
internal void RenewTest(ParametersValidation validationRequest, out StepType stepType, out SoapException exc, out int timeout) { VoidCommand("Renew", Renew, validationRequest, true, out stepType, out exc, out timeout); }
internal bool DeleteNetworkInterfaceDot1XConfigurationTest(ParametersValidation validationRequest, out StepType stepType, out SoapException exc, out int timeout) { return(GetCommand <bool>("DeleteNetworkInterfaceDot1XConfiguration", DeleteNetworkInterfaceDot1XConfiguration, validationRequest, true, out stepType, out exc, out timeout)); }
public bool CanStep(StepType type) { return(false); }
internal string[] GetAssignedCertPathValidationPoliciesTest(ParametersValidation validationRequest, out StepType stepType, out SoapException exc, out int timeout) { return(GetCommand <string[]>("GetAssignedCertPathValidationPolicies", GetAssignedCertPathValidationPolicies, validationRequest, true, out stepType, out exc, out timeout)); }
internal void ReplaceCertPathValidationPolicyAssignmentTest(ParametersValidation validationRequest, out StepType stepType, out SoapException exc, out int timeout) { VoidCommand("ReplaceCertPathValidationPolicyAssignment", ReplaceCertPathValidationPolicyAssignment, validationRequest, true, out stepType, out exc, out timeout); }
public EditingStep(StepType type, float factor) // for stretch { this.type = type; this.stretchFactor = factor; }
public void Step(StepType type) => throw new NotImplementedException();
protected Parser(string text, StepType stepType, bool hasNewLine = false, bool hasParens = false) { Step = new ComputeStep(stepType); Evaluate = new LiteralParse(text); ParseType = stepType; Step.HasParens = hasParens; Step.HasNewLine = hasNewLine; switch (stepType) { case StepType.Parse: case StepType.List: case StepType.Vector: Step.Evaluate = Evaluate; TryParse(); break; case StepType.Index: break; case StepType.String: Step.Evaluate = new LiteralString(Step, text); break; case StepType.Double: TryAddLiteralNumber(); break; case StepType.Integer: TryAddLiteralNumber(); break; case StepType.BitField: TryAddLiteralNumber(); break; case StepType.Property: Step.Evaluate = Evaluate; // the property name is needed by Step.TryValidate() break; default: break; } #region TryAddLiteralNumber ========================================== bool TryAddLiteralNumber() { var(ok, isDouble, v, d) = Value.ParseNumber(Evaluate.Text); if (ok) { if (isDouble) { Step.Evaluate = new LiteralDouble(Step, d, Evaluate.Text); } else { Step.Evaluate = new LiteralInt64(Step, v, Evaluate.Text); } return(true); } else { Step.Error = StepError.InvalidNumber; Step.Evaluate = Evaluate; } return(false); } #endregion }
void AddStepMethod(StepType stepType, Func <Task> action) { _scenarioRunner.AddStep(new StepMethodInvoker(stepType, action.GetMethodInfo())); }
internal string CreateProfileTest(ParametersValidation validationRequest, out StepType stepType, out SoapException exc, out int timeout) { return(GetCommand <string>("CreateProfile", CreateProfile, validationRequest, true, out stepType, out exc, out timeout)); }
internal Capabilities2 GetServiceCapabilitiesTest(ParametersValidation validationRequest, out StepType stepType, out SoapException exc, out int timeout) { return(GetCommand <Capabilities2>("GetServiceCapabilities", GetServiceCapabilities, validationRequest, true, out stepType, out exc, out timeout)); }
internal OSDConfiguration[] GetOSDsTest(ParametersValidation validationRequest, out StepType stepType, out SoapException exc, out int timeout) { return(GetCommand <OSDConfiguration[]>("GetOSDs", GetOSDs, validationRequest, true, out stepType, out exc, out timeout)); }
internal Dot1XConfiguration GetDot1XConfigurationTest(ParametersValidation validationRequest, out StepType stepType, out SoapException exc, out int timeout) { return(GetCommand <Dot1XConfiguration>("GetDot1XConfiguration", GetDot1XConfiguration, validationRequest, true, out stepType, out exc, out timeout)); }
internal string GetNetworkInterfaceDot1XConfigurationTest(ParametersValidation validationRequest, out StepType stepType, out SoapException exc, out int timeout) { return(GetCommand <string>("GetNetworkInterfaceDot1XConfiguration", GetNetworkInterfaceDot1XConfiguration, validationRequest, true, out stepType, out exc, out timeout)); }
public EditingStep(StepType type) // for mirror { this.type = type; }
internal void SetClientAuthenticationRequiredTest(ParametersValidation validationRequest, out StepType stepType, out SoapException exc, out int timeout) { VoidCommand("SetClientAuthenticationRequired", SetClientAuthenticationRequired, validationRequest, true, out stepType, out exc, out timeout); }
internal void StopMulticastStreamingTest(ParametersValidation validationRequest, out StepType stepType, out SoapException exc, out int timeout) { VoidCommand("StopMulticastStreaming", StopMulticastStreaming, validationRequest, true, out stepType, out exc, out timeout); }
internal UnsubscribeResponse UnsubscribeTest(ParametersValidation validationRequest, out StepType stepType, out SoapException exc, out int timeout) { VoidCommand("Unsubscribe", Unsubscribe, validationRequest, true, out stepType, out exc, out timeout); return(null); }
internal bool GetClientAuthenticationRequiredTest(ParametersValidation validationRequest, out StepType stepType, out SoapException exc, out int timeout) { return(GetCommand <bool>("GetClientAuthenticationRequired", GetClientAuthenticationRequired, validationRequest, true, out stepType, out exc, out timeout)); }
internal void SetSynchronizationPointTest(ParametersValidation validationRequest, out StepType stepType, out SoapException exc, out int timeout) { VoidCommand("SetSynchronizationPoint", SetSynchronizationPoint, validationRequest, true, out stepType, out exc, out timeout); }
public TranslationMovement(Transform transform, float speed, StepType step, bool terrestrial, Vector3? offset = null) : base(transform, speed, step, terrestrial, offset) { }
void AddStepMethod(StepType stepType, MethodBase method, params object[] parameterValues) { var parameters = ExtractParameters(method, parameterValues); _scenarioRunner.AddStep(new StepMethodInvoker(stepType, method, parameters)); }
protected override void ProcessRecord() { int[] leftHash = null; int[] rightHash = null; if (this.UseHash) { leftHash = Left.Select(x => x.GetHashCode()).ToArray(); rightHash = Right.Select(x => x.GetHashCode()).ToArray(); } StepType[][] d = new StepType[Left.Length + 1][]; LinkedList<Position> queue = new LinkedList<Position>(); int i, j; queue.AddFirst(new Position(0, 0)); for (i = 0; i <= Left.Length; i++) { d[i] = new StepType[Right.Length + 1]; } d[0][0] = StepType.None; while (queue.Count > 0) { Position curPos = queue.First(); queue.RemoveFirst(); i = curPos.x; j = curPos.y; if (i == Left.Length && j == Right.Length) { break; } if (j < Right.Length && d[i][j + 1] == StepType.None) { d[i][j + 1] = StepType.Right; queue.AddLast(new Position(i, j + 1)); } if (i < Left.Length && d[i + 1][j] == StepType.None) { d[i + 1][j] = StepType.Left; queue.AddLast(new Position(i + 1, j)); } if (i < Left.Length && j < Right.Length && d[i+1][j+1] == StepType.None && (!this.UseHash || leftHash[i] == rightHash[j]) && Left[i].Equals(Right[j])) { d[i+1][j+1] = StepType.Same; queue.AddFirst(new Position(i + 1, j + 1)); } } i = Left.Length; j = Right.Length; var diffs = new LinkedList<DiffObject>(); while (i > 0 || j > 0) { DiffObject diffObject = new DiffObject() {SideIndicator = StepToString(d[i][j])}; switch (d[i][j]) { case StepType.Left: { diffObject.InputObject = Left[--i]; break; } case StepType.Right: { diffObject.InputObject = Right[--j]; break; } case StepType.Same: { diffObject.InputObject = Right[--j]; --i; break; } default: throw new ArgumentOutOfRangeException(); } diffs.AddFirst(diffObject); } foreach (var diffObject in diffs) { WriteObject(diffObject); } }
/// <summary> /// The Copy Constructor /// </summary> /// <param name="rhs">The Line object from which to copy</param> public Line( Line rhs ) : base(rhs) { _color = rhs._color; _stepType = rhs._stepType; _isSmooth = rhs._isSmooth; _smoothTension = rhs._smoothTension; _fill = rhs._fill.Clone(); _isOptimizedDraw = rhs._isOptimizedDraw; }
internal AudioDecoderConfiguration[] GetAudioDecoderConfigurationsTest(ParametersValidation validationRequest, out StepType stepType, out SoapException exc, out int timeout) { return(GetCommand <AudioDecoderConfiguration[]>("GetAudioDecoderConfigurations", GetAudioDecoderConfigurations, validationRequest, true, out stepType, out exc, out timeout)); }
internal void DeleteDot1XConfigurationTest(ParametersValidation validationRequest, out StepType stepType, out SoapException exc, out int timeout) { VoidCommand("DeleteDot1XConfiguration", DeleteDot1XConfiguration, validationRequest, true, out stepType, out exc, out timeout); }
public void Draw(int Reason) { this.Reason = Reason; this.Type = StepType.STEP_DRAW; }
internal void SetAudioSourceConfigurationTest(ParametersValidation validationRequest, out StepType stepType, out SoapException exc, out int timeout) { VoidCommand("SetAudioSourceConfiguration", SetAudioSourceConfiguration, validationRequest, true, out stepType, out exc, out timeout); }
private string StepToString(StepType step) { switch (step) { case StepType.Left: return "<="; case StepType.Right: return "=>"; case StepType.Same: return "=="; default: throw new ArgumentOutOfRangeException("step"); } }
internal VideoSourceConfigurationOptions GetVideoSourceConfigurationOptionsTest(ParametersValidation validationRequest, out StepType stepType, out SoapException exc, out int timeout) { return(GetCommand <VideoSourceConfigurationOptions>("GetVideoSourceConfigurationOptions", GetVideoSourceConfigurationOptions, validationRequest, true, out stepType, out exc, out timeout)); }
/// <summary> /// Constructor that sets the color property to the specified value, and sets /// the remaining <see cref="Line"/> properties to default /// values as defined in the <see cref="Default"/> class. /// </summary> /// <param name="color">The color to assign to this new Line object</param> public Line( Color color ) { _color = color.IsEmpty ? Default.Color : color; _stepType = Default.StepType; _isSmooth = Default.IsSmooth; _smoothTension = Default.SmoothTension; _fill = new Fill( Default.FillColor, Default.FillBrush, Default.FillType ); _isOptimizedDraw = Default.IsOptimizedDraw; }
internal void SetOSDTest(ParametersValidation validationRequest, out StepType stepType, out SoapException exc, out int timeout) { VoidCommand("SetOSD", SetOSD, validationRequest, true, out stepType, out exc, out timeout); }
/// <summary> /// Constructor for deserializing objects /// </summary> /// <param name="info">A <see cref="SerializationInfo"/> instance that defines the serialized data /// </param> /// <param name="context">A <see cref="StreamingContext"/> instance that contains the serialized data /// </param> protected Line( SerializationInfo info, StreamingContext context ) : base(info, context) { // The schema value is just a file version parameter. You can use it to make future versions // backwards compatible as new member variables are added to classes int sch = info.GetInt32( "schema" ); //if ( sch >= 14 ) // _color = (Color) info.GetValue( "color", typeof( Color ) ); _stepType = (StepType)info.GetValue( "stepType", typeof( StepType ) ); _isSmooth = info.GetBoolean( "isSmooth" ); _smoothTension = info.GetSingle( "smoothTension" ); _fill = (Fill)info.GetValue( "fill", typeof( Fill ) ); if ( sch >= 13 ) _isOptimizedDraw = info.GetBoolean( "isOptimizedDraw" ); }
internal string GetSnapshotUriTest(ParametersValidation validationRequest, out StepType stepType, out SoapException exc, out int timeout) { return(GetCommand <string>("GetSnapshotUri", GetSnapshotUri, validationRequest, true, out stepType, out exc, out timeout)); }