本文整理汇总了C#中Scenario.AddStep方法的典型用法代码示例。如果您正苦于以下问题:C# Scenario.AddStep方法的具体用法?C# Scenario.AddStep怎么用?C# Scenario.AddStep使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Scenario
的用法示例。
在下文中一共展示了Scenario.AddStep方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Should_convert_scenario_to_string
public void Should_convert_scenario_to_string()
{
var feature = new Feature("featureTitle", "", "source", 1);
var scenario = new Scenario("scenarioTitle", "source", feature, 3);
scenario.AddStep(new StringStep("Given a step", "source, 4"));
scenario.AddStep(new StringStep("And another step", "source, 5"));
var scenarioAsString = scenario.ToString();
string expected = string.Format("Scenario: scenarioTitle{0} Given a step{0} And another step", Environment.NewLine);
Assert.AreEqual(expected, scenarioAsString);
}
示例2: CreateScenarioWithTable
private Scenario CreateScenarioWithTable(Feature feature)
{
var scenario = new Scenario("title", "", feature);
var givenStep = new StringTableStep("Given name [x]", "");
givenStep.AddTableStep(new Example(new ExampleColumns(new[] { new ExampleColumn("x") }), new Dictionary<string, string> { { "x", "Nisse" } }));
givenStep.AddTableStep(new Example(new ExampleColumns(new[] { new ExampleColumn("x") }), new Dictionary<string, string> { { "x", "Kalle" } }));
scenario.AddStep(givenStep);
scenario.AddStep(new StringStep("When greeted", ""));
var thenStep = new StringTableStep("Then Hello [y]", "");
thenStep.AddTableStep(new Example(new ExampleColumns(new[] { new ExampleColumn("y"), }), new Dictionary<string, string> { { "y", "Nisse" } }));
thenStep.AddTableStep(new Example(new ExampleColumns(new[] { new ExampleColumn("y"), }), new Dictionary<string, string> { { "y", "Kålle" } }));
scenario.AddStep(thenStep);
return scenario;
}
示例3: Should_include_examples_when_converting_to_string
public void Should_include_examples_when_converting_to_string()
{
var feature = new Feature("featureTitle", "", "source", 1);
var scenario = new Scenario("scenarioTitle", "source", feature, 3);
scenario.AddStep(new StringStep("Given a [foo]", "source, 4"));
scenario.AddStep(new StringStep("And [bar]", "source, 5"));
var columnNames = new ExampleColumns { new ExampleColumn("foo"), new ExampleColumn("bar") };
scenario.AddExamples(new[]
{
new Example(columnNames, new Dictionary<string, string>{ {"foo", "1"}, {"bar", "2"}}),
new Example(columnNames, new Dictionary<string, string>{ {"foo", "11"}, {"bar", "22"}})
});
var scenarioAsString = scenario.ToString();
string expected = string.Format("Scenario: scenarioTitle{0} Given a [foo]{0} And [bar]{0}", Environment.NewLine);
expected += "Examples:" + Environment.NewLine +
" | foo | bar |" + Environment.NewLine +
" | 1 | 2 |" + Environment.NewLine +
" | 11 | 22 |";
Assert.AreEqual(expected, scenarioAsString);
}
示例4: Should_convert_background_to_string
public void Should_convert_background_to_string()
{
var feature = new Feature("Title", string.Format(" As a x{0} I want y{0} So that z", Environment.NewLine), "source", 1);
var background = new Scenario("backgroundTitle", "source", feature, 4);
background.AddStep(new StringStep("Given a background step", "source, 5"));
feature.AddBackground(background);
var featureAsString = feature.ToString();
string expected = string.Format("Feature: Title{0} As a x{0} I want y{0} So that z", Environment.NewLine);
expected += string.Format("{0}{0} Background: backgroundTitle{0} Given a background step", Environment.NewLine);
Assert.AreEqual(expected, featureAsString);
}