本文整理汇总了C#中PropertyDictionary.ToDictionary方法的典型用法代码示例。如果您正苦于以下问题:C# PropertyDictionary.ToDictionary方法的具体用法?C# PropertyDictionary.ToDictionary怎么用?C# PropertyDictionary.ToDictionary使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PropertyDictionary
的用法示例。
在下文中一共展示了PropertyDictionary.ToDictionary方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TestTranslation
public void TestTranslation()
{
PropertyDictionary<ProjectPropertyInstance> properties = new PropertyDictionary<ProjectPropertyInstance>();
properties.Set(ProjectPropertyInstance.Create("this", "that"));
properties.Set(ProjectPropertyInstance.Create("foo", "bar"));
BuildRequestData data = new BuildRequestData("file", properties.ToDictionary(), "4.0", new string[0], null);
BuildRequestConfiguration config = new BuildRequestConfiguration(data, "2.0");
Assert.Equal(NodePacketType.BuildRequestConfiguration, config.Type);
((INodePacketTranslatable)config).Translate(TranslationHelpers.GetWriteTranslator());
INodePacket packet = BuildRequestConfiguration.FactoryForDeserialization(TranslationHelpers.GetReadTranslator());
BuildRequestConfiguration deserializedConfig = packet as BuildRequestConfiguration;
Assert.Equal(config, deserializedConfig);
}
示例2: TestEquals
public void TestEquals()
{
BuildRequestConfiguration config1 = new BuildRequestConfiguration(new BuildRequestData("file", new Dictionary<string, string>(), "toolsVersion", new string[0], null), "2.0");
Assert.Equal(config1, config1);
BuildRequestConfiguration config2 = new BuildRequestConfiguration(new BuildRequestData("file", new Dictionary<string, string>(), "toolsVersion", new string[0], null), "2.0");
Assert.Equal(config1, config2);
BuildRequestConfiguration config3 = new BuildRequestConfiguration(new BuildRequestData("file2", new Dictionary<string, string>(), "toolsVersion", new string[0], null), "2.0");
Assert.NotEqual(config1, config3);
BuildRequestConfiguration config4 = new BuildRequestConfiguration(new BuildRequestData("file", new Dictionary<string, string>(), "toolsVersion2", new string[0], null), "2.0");
Assert.NotEqual(config1, config4);
PropertyDictionary<ProjectPropertyInstance> props = new PropertyDictionary<ProjectPropertyInstance>();
props.Set(ProjectPropertyInstance.Create("prop1", "value1"));
BuildRequestData data = new BuildRequestData("file", props.ToDictionary(), "toolsVersion", new string[0], null);
BuildRequestConfiguration config5 = new BuildRequestConfiguration(data, "2.0");
Assert.NotEqual(config1, config5);
Assert.Equal(config1, config2);
Assert.NotEqual(config1, config3);
}