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"]);
        }
        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]"));
        }
        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"]);
        }
        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"));
        }
        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"]);
        }