public override int GetHashCode() { int hash = 1; if (Name.Length != 0) { hash ^= Name.GetHashCode(); } if (SinceVersion != 0L) { hash ^= SinceVersion.GetHashCode(); } if (Status != global::Onnx.OperatorStatus.Experimental) { hash ^= Status.GetHashCode(); } hash ^= input_.GetHashCode(); hash ^= output_.GetHashCode(); hash ^= attribute_.GetHashCode(); hash ^= node_.GetHashCode(); if (DocString.Length != 0) { hash ^= DocString.GetHashCode(); } hash ^= opsetImport_.GetHashCode(); if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } return(hash); }
private static StepArgument CreatePickleArguments(StepArgument argument, Dictionary <string, string> parameters) { if (argument == null) { return(null); } if (argument is DataTable) { DataTable t = (DataTable)argument; var rows = t.Rows; var newRows = new List <TableRow>(rows.Count()); foreach (var row in rows) { var cells = row.Cells; var newCells = new List <TableCell>(); foreach (var cell in cells) { newCells.Add(new TableCell(cell.Location, Interpolate(cell.Value, parameters))); } newRows.Add(new TableRow(row.Location, newCells.ToArray())); } return(new DataTable(newRows.ToArray())); } if (argument is DocString) { DocString ds = (DocString)argument; return(new DocString( ds.Location, ds.ContentType, Interpolate(ds.Content, parameters) )); } throw new InvalidOperationException("Unexpected argument type: " + argument); }
public override int GetHashCode() { int hash = 1; if (Magic.Length != 0) { hash ^= Magic.GetHashCode(); } if (IrVersion != 0) { hash ^= IrVersion.GetHashCode(); } if (IrVersionPrerelease.Length != 0) { hash ^= IrVersionPrerelease.GetHashCode(); } if (IrBuildMetadata.Length != 0) { hash ^= IrBuildMetadata.GetHashCode(); } if (Domain.Length != 0) { hash ^= Domain.GetHashCode(); } if (OpsetVersion != 0L) { hash ^= OpsetVersion.GetHashCode(); } if (DocString.Length != 0) { hash ^= DocString.GetHashCode(); } hash ^= operator_.GetHashCode(); return(hash); }
public void AddArg(DocString docString) { if (currentStep != null) { currentStep.DocStringArg = docString; } }
public void AndWithParameterAndMultilineValue(string parameterName, DocString parameterValue) { if (!string.IsNullOrEmpty(parameterName) && !string.IsNullOrEmpty(parameterValue.Content)) { GetResponseHandler.QueryString.Add(parameterName, WebUtility.UrlEncode(parameterValue.Content)); } }
public void And_The_Request_Body_as_following(string contentType, DocString content) { RequestBody = content.Content; if (!string.IsNullOrEmpty(contentType)) { RequestContentType = contentType.Trim(); } }
public void ThenTheResponseShouldBe(DocString json) { var expectedJObject = JsonConvert.DeserializeObject <JObject>(json.Content); ObjectComparer.RoundAllDoubleProperties(GetResponseHandler.CurrentResponse as JObject, roundingPrecision: 8); ObjectComparer.RoundAllDoubleProperties(expectedJObject, roundingPrecision: 8); ObjectComparer.AssertAreEqual(actualResultObj: GetResponseHandler.CurrentResponse, expectedResultObj: expectedJObject, ignoreCase: true); }
public void ThenTheResponseShouldBe(DocString json) { // We deliberately serialize to formatted JSON because if the test fails it's easier to see the actual vs expected which comparing JObjects doesn't give us. var expectedJObject = JsonConvert.DeserializeObject <JObject>(json.Content); var actualJObject = JObject.FromObject(PostRequestHandler.CurrentResponse); ObjectComparer.RoundAllDoubleProperties(actualJObject, roundingPrecision: 8); ObjectComparer.RoundAllDoubleProperties(expectedJObject, roundingPrecision: 8); ObjectComparer.AssertAreEqual(actualResultObj: actualJObject, expectedResultObj: expectedJObject); }
private static StringBuilder WriteStep(StringBuilder sb, Step step) { sb.AppendLine($"**_{step.Keyword.TrimEnd(' ')}_** {step.Text.ToMarkup()}<br />"); if (step.Argument is DataTable) { DataTable tArg = (DataTable)step.Argument; if (tArg.Rows.First().Cells.Count() == 1) { // this should be code-snippet string lang = tArg.Rows.First().Cells.First().Value; sb.AppendLine($"```{lang}"); foreach (var r in tArg.Rows.Skip(1)) { sb.AppendLine(r.Cells.First().Value); } sb.AppendLine($"```"); } else { bool isHeader = true; foreach (var r in tArg.Rows) { sb.Append("| "); if (isHeader) { sb.Append(string.Join(" | ", r.Cells.Select(x => x.Value.Humanize()))); } else { sb.Append(string.Join(" | ", r.Cells.Select(x => x.Value.ToMarkup()))); } sb.Append(" |"); sb.AppendLine(); if (isHeader) { isHeader = false; sb.Append("| "); sb.Append(string.Join(" | ", r.Cells.Select(x => "---"))); sb.Append(" |"); } } } } else if (step.Argument is DocString) { DocString str = (DocString)step.Argument; // we don't know } return(sb); }
protected virtual List <Argument> CreatePickleArguments(StepArgument argument, IEnumerable <TableCell> variableCells, IEnumerable <TableCell> valueCells) { var result = new List <Argument>(); if (argument == null) { return(result); } if (argument is DataTable) { DataTable t = (DataTable)argument; var rows = t.Rows; var newRows = new List <PickleRow>(rows.Count()); foreach (var row in rows) { var cells = row.Cells; var newCells = new List <PickleCell>(); foreach (var cell in cells) { newCells.Add( new PickleCell( PickleLocation(cell.Location), Interpolate(cell.Value, variableCells, valueCells) ) ); } newRows.Add(new PickleRow(newCells)); } result.Add(new PickleTable(newRows)); } else if (argument is DocString) { DocString ds = (DocString)argument; result.Add( new PickleString( PickleLocation(ds.Location), Interpolate(ds.Content, variableCells, valueCells), ds.ContentType == null ? null : Interpolate(ds.ContentType, variableCells, valueCells) ) ); } else { throw new InvalidOperationException("Unexpected argument type: " + argument); } return(result); }
private void FormatDocString(DocString docString, StringBuilder result) { result.Append(STEPARG_INDENT + GherkinLanguageConstants.DOCSTRING_SEPARATOR); if (docString.ContentType != null) { result.Append(docString.ContentType); } result.AppendLine(); var lines = docString.Content.Split(new[] { Environment.NewLine }, StringSplitOptions.None); foreach (var line in lines) { result.Append(STEPARG_INDENT); result.AppendLine(line); } result.AppendLine(STEPARG_INDENT + GherkinLanguageConstants.DOCSTRING_SEPARATOR); }
public override int GetHashCode() { int hash = 1; if (Magic.Length != 0) { hash ^= Magic.GetHashCode(); } if (IrVersion != 0L) { hash ^= IrVersion.GetHashCode(); } if (IrVersionPrerelease.Length != 0) { hash ^= IrVersionPrerelease.GetHashCode(); } if (IrBuildMetadata.Length != 0) { hash ^= IrBuildMetadata.GetHashCode(); } if (Domain.Length != 0) { hash ^= Domain.GetHashCode(); } if (OpsetVersion != 0L) { hash ^= OpsetVersion.GetHashCode(); } if (DocString.Length != 0) { hash ^= DocString.GetHashCode(); } hash ^= operator_.GetHashCode(); hash ^= functions_.GetHashCode(); if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } return(hash); }
private ReportStepArgument ConvertArgument(StepArgument argument) { if (argument == null) { return(null); } if (argument is DocString) { DocString arg = (DocString)argument; return(new DocStringArgument(arg.ContentType, arg.Content)); } if (argument is DataTable) { DataTable arg = (DataTable)argument; return(new TableArgument(arg.Rows.Select(r => new ReportTableRow(r.Cells.Select(c => new ReportTableCell(c.Value)).ToList())).ToList())); } return(null); }
public void docString(DocString docString) { throw new NotImplementedException(); }
public void I_should_have_text_like_this(DocString text) { Assert.Equal(text.Content, _textBuilder.ToString()); }
public void I_have_a_text_like_this(DocString text) { _textBuilder = new StringBuilder(text.Content); }
void IVisitable.Accept(DocString docString) { stepImplBuilder.AddArg(docString); }
public async Task Then_I_should_get_a_http_status_and_following_content(string expectedStatus, DocString content) { var expectedContent = content.Content.Replace(Environment.NewLine, string.Empty); Assert.Equal(expectedStatus, Response.ReasonPhrase); var responseContent = await Response.Content.ReadAsStringAsync(); Assert.Equal(expectedContent, responseContent); }
public void AddDocString(DocStringBuilder item) { this.docString = item.Build(); }
private CodeExpression GetDocStringArgExpression(DocString docString, ParameterSubstitution paramToIdentifier) { return(GetSubstitutedString(docString == null ? null : docString.Content, paramToIdentifier)); }
public void AddDocString(DocString docString) { this.DocString = docString; }