public void TestGetJQueryNameValuePairs() { // Arrange var formData = new FormDataCollection("x.y=30&x[y]=70&x[z][20]=cool"); // Act var actual = FormDataCollectionExtensions.GetJQueryNameValuePairs(formData).ToArray(); // Assert var arraySetter = Assert.Single(actual, kvp => kvp.Key == "x.z[20]"); Assert.Equal("cool", arraySetter.Value); Assert.Single(actual, kvp => kvp.Key == "x.y" && kvp.Value == "30"); Assert.Single(actual, kvp => kvp.Key == "x.y" && kvp.Value == "70"); }
[InlineData("x.y[234].x", "x[y][234][x]")] // compound public void TestNormalize(string expectedMvc, string jqueryString) { Assert.Equal(expectedMvc, FormDataCollectionExtensions.NormalizeJQueryToMvc(jqueryString)); }