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


C# Properties.should_contain方法代码示例

本文整理汇总了C#中Properties.should_contain方法的典型用法代码示例。如果您正苦于以下问题:C# Properties.should_contain方法的具体用法?C# Properties.should_contain怎么用?C# Properties.should_contain使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Properties的用法示例。


在下文中一共展示了Properties.should_contain方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: when_creating_properties


//.........这里部分代码省略.........
                var expectedProperties = new Dictionary<string, string> {
                    { "some.key", "some value" },
                    { "some.other.key", "other value" }
                };

                assertProperties(input, expectedOutput, expectedProperties);
            };

            it["trims leading whitespace of multilines"] = () => {
                var input =
                    "some.key=some val\\" + "\n" + "   ue" + "\n" +
                    "some.other.key=other val\\" + "\n" + "   ue" + "\n";

                const string expectedOutput =
                    "some.key = some value\n" +
                    "some.other.key = other value\n";

                var expectedProperties = new Dictionary<string, string> {
                    { "some.key", "some value" },
                    { "some.other.key", "other value" }
                };

                assertProperties(input, expectedOutput, expectedProperties);
            };

            it["has all keys"] = () => {
                var input =
                    "some.key.1=some value 1" + "\n" +
                    " some.key.2 = some value 2 " + "\n" +
                    "some.key.3=some value 3" + "\n";

                var keys = new Properties(input).keys;
                keys.Length.should_be(3);
                keys.should_contain("some.key.1");
                keys.should_contain("some.key.2");
                keys.should_contain("some.key.3");
            };

            it["has all values"] = () => {
                var input =
                    "some.key.1=some value 1" + "\n" +
                    " some.key.2 = some value 2 " + "\n" +
                    "some.key.3=some value 3" + "\n";

                var values = new Properties(input).values;
                values.Length.should_be(3);
                values.should_contain("some value 1");
                values.should_contain("some value 2 ");
                values.should_contain("some value 3");
            };
        };

        context["when replacing special characters in values"] = () => {
            it["replaces \\n with newline"] = () => {
                var input =
                    @"some.key=some\nvalue" + "\n" +
                    @"some.other.key=other\nvalue" + "\n";

                const string expectedOutput =
                    @"some.key = some\nvalue" + "\n" +
                    @"some.other.key = other\nvalue" + "\n";

                var expectedProperties = new Dictionary<string, string> {
                    { "some.key", "some\nvalue" },
                    { "some.other.key", "other\nvalue" }
                };
开发者ID:ChicK00o,项目名称:Entitas-CSharp,代码行数:67,代码来源:describe_Properties.cs


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