本文整理汇总了C#中PicklesDoc.Pickles.ObjectModel.ScenarioOutline类的典型用法代码示例。如果您正苦于以下问题:C# ScenarioOutline类的具体用法?C# ScenarioOutline怎么用?C# ScenarioOutline使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ScenarioOutline类属于PicklesDoc.Pickles.ObjectModel命名空间,在下文中一共展示了ScenarioOutline类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ThenCanFormatCompleteScenarioOutlineCorrectly
public void ThenCanFormatCompleteScenarioOutlineCorrectly()
{
var table = new Table
{
HeaderRow = new TableRow("Var1", "Var2", "Var3", "Var4"),
DataRows =
new List<TableRow>(new[]
{
new TableRow("1", "2", "3", "4"),
new TableRow("5", "6", "7", "8")
})
};
var example = new Example { Name = "Some examples", Description = "An example", TableArgument = table };
var examples = new List<Example>();
examples.Add(example);
var scenarioOutline = new ScenarioOutline
{
Name = "Testing a scenario outline",
Description = "We need to make sure that scenario outlines work properly",
Examples = examples
};
var htmlScenarioOutlineFormatter = Container.Resolve<HtmlScenarioOutlineFormatter>();
var output = htmlScenarioOutlineFormatter.Format(scenarioOutline, 0);
Check.That(output).ContainsGherkinScenario();
Check.That(output).ContainsGherkinTable();
}
示例2: GetExampleResult
public TestResult GetExampleResult(ScenarioOutline scenarioOutline, string[] exampleValues)
{
XElement featureElement = this.GetFeatureElement(scenarioOutline.Feature);
XElement examplesElement = null;
if (featureElement != null)
{
var signatureBuilder = this.ExampleSignatureBuilder;
if (signatureBuilder == null)
{
throw new InvalidOperationException(
"You need to set the ExampleSignatureBuilder before using GetExampleResult.");
}
Regex exampleSignature = signatureBuilder.Build(scenarioOutline, exampleValues);
var parameterizedTestElement = featureElement
.Descendants("test-suite")
.FirstOrDefault(x => IsMatchingParameterizedTestElement(x, scenarioOutline));
if (parameterizedTestElement != null)
{
examplesElement = parameterizedTestElement.Descendants("test-case")
.FirstOrDefault(x => IsMatchingTestCase(x, exampleSignature));
}
}
return this.GetResultFromElement(examplesElement);
}
示例3: Format
public void Format(IXLWorksheet worksheet, ScenarioOutline scenarioOutline, ref int row)
{
int originalRow = row;
worksheet.Cell(row++, "B").Value = scenarioOutline.Name;
worksheet.Cell(row++, "C").Value = scenarioOutline.Description;
var results = this.testResults.GetScenarioOutlineResult(scenarioOutline);
if (this.configuration.HasTestResults && (results != TestResult.Inconclusive))
{
worksheet.Cell(originalRow, "B").Style.Fill.SetBackgroundColor(results == TestResult.Passed
? XLColor.AppleGreen
: XLColor.CandyAppleRed);
}
foreach (Step step in scenarioOutline.Steps)
{
this.excelStepFormatter.Format(worksheet, step, ref row);
}
row++;
foreach (var example in scenarioOutline.Examples)
{
worksheet.Cell(row++, "B").Value = "Examples";
worksheet.Cell(row, "C").Value = example.Description;
this.excelTableFormatter.Format(worksheet, example.TableArgument, ref row);
}
}
示例4: GetScenarioOutlineResult
public TestResult GetScenarioOutlineResult(ScenarioOutline scenarioOutline)
{
if (this.specRunFeatures == null)
{
return TestResult.Inconclusive;
}
var specRunFeature = this.FindSpecRunFeature(scenarioOutline.Feature);
if (specRunFeature == null)
{
return TestResult.Inconclusive;
}
Parser.SpecRun.Scenario[] specRunScenarios = FindSpecRunScenarios(scenarioOutline, specRunFeature);
if (specRunScenarios.Length == 0)
{
return TestResult.Inconclusive;
}
TestResult result = StringsToTestResult(specRunScenarios.Select(srs => srs.Result));
return result;
}
示例5: GetScenarioOutlineResult
public TestResult GetScenarioOutlineResult(ScenarioOutline scenarioOutline)
{
IEnumerable<assembliesAssemblyCollectionTest> exampleElements = this.GetScenarioOutlineElements(scenarioOutline);
int passedCount = 0;
int failedCount = 0;
int skippedCount = 0;
foreach (var exampleElement in exampleElements)
{
TestResult result = this.GetResultFromElement(exampleElement);
if (result == TestResult.Inconclusive)
{
skippedCount++;
}
if (result == TestResult.Passed)
{
passedCount++;
}
if (result == TestResult.Failed)
{
failedCount++;
}
}
return GetAggregateResult(passedCount, failedCount, skippedCount);
}
示例6: Format
public void Format(Body body, ScenarioOutline scenarioOutline)
{
if (this.configuration.HasTestResults)
{
TestResult testResult = this.testResults.GetScenarioOutlineResult(scenarioOutline);
if (testResult == TestResult.Passed)
{
body.GenerateParagraph("Passed", "Passed");
}
else if (testResult == TestResult.Failed)
{
body.GenerateParagraph("Failed", "Failed");
}
}
body.GenerateParagraph(scenarioOutline.Name, "Heading2");
if (!string.IsNullOrEmpty(scenarioOutline.Description))
{
body.GenerateParagraph(scenarioOutline.Description, "Normal");
}
foreach (Step step in scenarioOutline.Steps)
{
this.wordStepFormatter.Format(body, step);
}
foreach (var example in scenarioOutline.Examples)
{
body.GenerateParagraph("Examples: " + example.Description, "Heading3");
this.wordTableFormatter.Format(body, example.TableArgument);
}
}
示例7: FormatHeading
private XElement FormatHeading(ScenarioOutline scenarioOutline)
{
if (string.IsNullOrEmpty(scenarioOutline.Name))
{
return null;
}
var result = new XElement(
this.xmlns + "div",
new XAttribute("class", "scenario-heading"),
string.IsNullOrEmpty(scenarioOutline.Slug) ? null : new XAttribute("id", scenarioOutline.Slug),
new XElement(this.xmlns + "h2", scenarioOutline.Name));
var tags = RetrieveTags(scenarioOutline);
if (tags.Length > 0)
{
var paragraph = new XElement(this.xmlns + "p", HtmlScenarioFormatter.CreateTagElements(tags.OrderBy(t => t).ToArray(), this.xmlns));
paragraph.Add(new XAttribute("class", "tags"));
result.Add(paragraph);
}
result.Add(this.htmlDescriptionFormatter.Format(scenarioOutline.Description));
return result;
}
示例8: Format
public XElement Format(Table table, ScenarioOutline scenarioOutline, bool includeResults)
{
if (table == null) return null;
var headerCells = table.HeaderRow.ToArray();
if (includeResults)
{
headerCells = headerCells.Concat(new[] { " " }).ToArray();
}
return new XElement(this.xmlns + "div",
new XAttribute("class", "table_container"),
new XElement(this.xmlns + "table",
new XAttribute("class", "datatable"),
new XElement(this.xmlns + "thead",
new XElement(this.xmlns + "tr",
headerCells.Select(
cell => new XElement(this.xmlns + "th", cell))
)
),
new XElement(this.xmlns + "tbody",
table.DataRows.Select(row => this.FormatRow(row, scenarioOutline, includeResults))
)
));
}
示例9: IsMatch
public bool IsMatch(ScenarioOutline scenarioOutline, string[] exampleValues, object scenarioElement)
{
var element = (XElement)scenarioElement;
var valuesInScenario = element.DetermineValuesInScenario();
var isMatch = exampleValues.OrderBy(e => e).SequenceEqual(valuesInScenario.OrderBy(v => v));
return isMatch;
}
示例10: GetExampleResult
public override TestResult GetExampleResult(ScenarioOutline scenario, string[] exampleValues)
{
var cucumberScenarios = this.GetCucumberScenarios(scenario);
var query = cucumberScenarios.Where(cs => this.ScenarioHasStepsForAllExampleValues(cs.ScenarioBase, exampleValues))
.Select(cs => ToTestResult(cs.ScenarioBase, cs.Background));
return query.FirstOrDefault();
}
示例11: Build
public Regex Build(ScenarioOutline scenarioOutline, string[] row)
{
var stringBuilder = new StringBuilder();
stringBuilder.Append(Regex.Escape(scenarioOutline.Name));
stringBuilder.Append("(, Examples (\\d*))?");
stringBuilder.Append(", " + Regex.Escape(row[0]));
return new Regex(stringBuilder.ToString());
}
示例12: ThenCanSuccessfullyMatch
public void ThenCanSuccessfullyMatch()
{
var scenarioOutline = new ScenarioOutline {Name = "Adding several numbers"};
var exampleRow = new[] {"40", "50", "90"};
var signatureBuilder = Container.Resolve<xUnitExampleSignatureBuilder>();
Regex signature = signatureBuilder.Build(scenarioOutline, exampleRow);
signature.IsMatch("Pickles.TestHarness.xUnit.AdditionFeature.AddingSeveralNumbers(firstNumber: \"40\", secondNumber: \"50\", result: \"90\", exampleTags: System.String[])".ToLowerInvariant()).ShouldBeTrue();
}
示例13: Map_NoSteps_ReturnsEmtpyListOfSteps
public void Map_NoSteps_ReturnsEmtpyListOfSteps()
{
var scenarioOutline = new ScenarioOutline { Steps = null };
var mapper = CreateMapper();
JsonScenarioOutline actual = mapper.Map(scenarioOutline);
Check.That(actual.Steps.Count).IsEqualTo(0);
}
示例14: Map_NoExamples_ReturnsEmptyListOfExamples
public void Map_NoExamples_ReturnsEmptyListOfExamples()
{
var scenarioOutline = new ScenarioOutline { Examples = null };
var mapper = CreateMapper();
JsonScenarioOutline actual = mapper.Map(scenarioOutline);
Check.That(actual.Examples.Count).IsEqualTo(0);
}
示例15: Map_SomeScenarioOutline_ReturnsSomeJsonScenarioOutline
public void Map_SomeScenarioOutline_ReturnsSomeJsonScenarioOutline()
{
var scenarioOutline = new ScenarioOutline();
var mapper = CreateMapper();
JsonScenarioOutline actual = mapper.Map(scenarioOutline);
Check.That(actual).IsNotNull();
}