本文整理汇总了C#中Scenario.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# Scenario.ToString方法的具体用法?C# Scenario.ToString怎么用?C# Scenario.ToString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Scenario
的用法示例。
在下文中一共展示了Scenario.ToString方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: 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);
}
示例3: RequestAddressBookByABId
/// <summary>
/// Get a circle addressbook by addressbook identifier.
/// </summary>
/// <param name="abId"></param>
/// <param name="state"></param>
/// <param name="scene"></param>
/// <returns></returns>
private bool RequestAddressBookByABId(string abId, RelationshipState state, Scenario scene)
{
Trace.WriteLineIf(Settings.TraceSwitch.TraceVerbose, "Requesting AddressBook by ABId: " + abId + ", Scenario: " + scene.ToString());
abId = abId.ToLowerInvariant();
abHandleType individualAB = new abHandleType();
individualAB.ABId = abId;
individualAB.Cid = 0;
individualAB.Puid = 0;
switch (state)
{
case RelationshipState.Accepted:
requestCircleCount++;
try
{
NSMessageHandler.ContactService.abRequest(PartnerScenario.Initial, individualAB, null);
}
catch (Exception ex1)
{
requestCircleCount--;
Trace.WriteLineIf(Settings.TraceSwitch.TraceError, "[RequestAddressBookByABId] Error: " + ex1.Message);
}
break;
case RelationshipState.WaitingResponse:
try
{
NSMessageHandler.ContactService.abRequest(PartnerScenario.Initial, individualAB, null);
}
catch (Exception ex2)
{
Trace.WriteLineIf(Settings.TraceSwitch.TraceError, "[RequestAddressBookByABId] Error: " + ex2.Message);
}
break;
}
return true;
}