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


C# RouteValueDictionary.ToExtendedRouteValueDictionary方法代码示例

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


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

示例1: ToExtendedRouteValueDictionarySerializesComplexTypes

        public void ToExtendedRouteValueDictionarySerializesComplexTypes()
        {
            // Arrange
            var model = CreateModel();
            var routeValueDictionary = new RouteValueDictionary(model);

            // Act
            var extendedRouteValueDictionary = routeValueDictionary.ToExtendedRouteValueDictionary();

            // Assert
            Assert.Equal(model.FirstChild.Name, extendedRouteValueDictionary["FirstChild.Name"]);
            Assert.Equal(model.FirstChild.Age, extendedRouteValueDictionary["FirstChild.Age"]);
            Assert.Equal(model.FirstChild.Gender, extendedRouteValueDictionary["FirstChild.Gender"]);
        }
开发者ID:ErikSchierboom,项目名称:aspnetmvcserialization,代码行数:14,代码来源:RouteValueDictionaryExtensionsTests.cs

示例2: ToExtendedRouteValueDictionarySerializesEnumerableOfPrimitiveType

        public void ToExtendedRouteValueDictionarySerializesEnumerableOfPrimitiveType()
        {
            // Arrange
            var model = CreateModel();
            var routeValueDictionary = new RouteValueDictionary(model);

            // Act
            var extendedRouteValueDictionary = routeValueDictionary.ToExtendedRouteValueDictionary();

            // Assert
            Assert.Equal(model.ChildAges[0], extendedRouteValueDictionary["ChildAges[0]"]);
            Assert.Equal(model.ChildAges[1], extendedRouteValueDictionary["ChildAges[1]"]);

            Assert.False(extendedRouteValueDictionary.ContainsKey("ChildAges[2]"));
        }
开发者ID:ErikSchierboom,项目名称:aspnetmvcserialization,代码行数:15,代码来源:RouteValueDictionaryExtensionsTests.cs

示例3: ToExtendedRouteValueDictionarySerializesDictionary

        public void ToExtendedRouteValueDictionarySerializesDictionary()
        {
            // Arrange
            var model = CreateModel();
            var routeValueDictionary = new RouteValueDictionary(model);

            // Act
            var extendedRouteValueDictionary = routeValueDictionary.ToExtendedRouteValueDictionary();

            // Assert
            Assert.Equal(model.ChildNameAndAge.Keys.ElementAt(0), extendedRouteValueDictionary["ChildNameAndAge[0].Key"]);
            Assert.Equal(model.ChildNameAndAge.Values.ElementAt(0), extendedRouteValueDictionary["ChildNameAndAge[0].Value"]);

            Assert.Equal(model.ChildNameAndAge.Keys.ElementAt(1), extendedRouteValueDictionary["ChildNameAndAge[1].Key"]);
            Assert.Equal(model.ChildNameAndAge.Values.ElementAt(1), extendedRouteValueDictionary["ChildNameAndAge[1].Value"]);
        }
开发者ID:ErikSchierboom,项目名称:aspnetmvcserialization,代码行数:16,代码来源:RouteValueDictionaryExtensionsTests.cs

示例4: ToExtendedRouteValueDictionarySerializesEnumerableOfComplexType

        public void ToExtendedRouteValueDictionarySerializesEnumerableOfComplexType()
        {
            // Arrange
            var model = CreateModel();
            var routeValueDictionary = new RouteValueDictionary(model);

            // Act
            var extendedRouteValueDictionary = routeValueDictionary.ToExtendedRouteValueDictionary();

            // Assert
            Assert.Equal(model.Children[0].Name, extendedRouteValueDictionary["Children[0].Name"]);
            Assert.Equal(model.Children[0].Age, extendedRouteValueDictionary["Children[0].Age"]);
            Assert.Equal(model.Children[1].Name, extendedRouteValueDictionary["Children[1].Name"]);
            Assert.Equal(model.Children[1].Age, extendedRouteValueDictionary["Children[1].Age"]);

            Assert.False(extendedRouteValueDictionary.ContainsKey("Children[2].Name"));
            Assert.False(extendedRouteValueDictionary.ContainsKey("Children[2].Age"));
        }
开发者ID:ErikSchierboom,项目名称:aspnetmvcserialization,代码行数:18,代码来源:RouteValueDictionaryExtensionsTests.cs

示例5: ToExtendedRouteValueDictionarySerializesPrimitiveTypes

        public void ToExtendedRouteValueDictionarySerializesPrimitiveTypes()
        {
            // Arrange
            var model = CreateModel();
            var routeValueDictionary = new RouteValueDictionary(model);

            // Act
            var extendedRouteValueDictionary = routeValueDictionary.ToExtendedRouteValueDictionary();

            // Assert
            Assert.Equal(model.Name, extendedRouteValueDictionary["Name"]);
            Assert.Equal(model.Age, extendedRouteValueDictionary["Age"]);
            Assert.Equal(model.Gender, extendedRouteValueDictionary["Gender"]);
        }
开发者ID:ErikSchierboom,项目名称:aspnetmvcserialization,代码行数:14,代码来源:RouteValueDictionaryExtensionsTests.cs


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