本文整理汇总了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" }
};