当前位置: 首页>>代码示例>>C#>>正文


C# Scenario.ToString方法代码示例

本文整理汇总了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);
 }
开发者ID:smhabdoli,项目名称:NBehave,代码行数:10,代码来源:ScenarioSpec.cs

示例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);
 }
开发者ID:smhabdoli,项目名称:NBehave,代码行数:20,代码来源:ScenarioSpec.cs

示例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;
        }
开发者ID:quynh68,项目名称:msnp-sharp,代码行数:46,代码来源:XMLContactList.cs


注:本文中的Scenario.ToString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。