-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
borrow ideas from the chris ortman fork, but keep the same feel as th…
…e original framework
- Loading branch information
1 parent
add6e33
commit e246326
Showing
23 changed files
with
4,672 additions
and
136 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
MvcIntegrationTestFramework/NameValueCollectionConversions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
using System.Collections.Specialized; | ||
using System.Web.Routing; | ||
|
||
namespace MvcIntegrationTestFramework | ||
{ | ||
public static class NameValueCollectionConversions | ||
{ | ||
public static NameValueCollection ConvertFromObject(object anonymous) | ||
{ | ||
var nvc = new NameValueCollection(); | ||
var dict = new RouteValueDictionary(anonymous); | ||
|
||
foreach (var kvp in dict) | ||
{ | ||
if (kvp.Value.GetType().Name.Contains("Anonymous")) | ||
{ | ||
var prefix = kvp.Key + "."; | ||
foreach (var innerkvp in new RouteValueDictionary(kvp.Value)) | ||
{ | ||
nvc.Add(prefix + innerkvp.Key, innerkvp.Value.ToString()); | ||
} | ||
} | ||
else | ||
{ | ||
nvc.Add(kvp.Key, kvp.Value.ToString()); | ||
} | ||
|
||
|
||
} | ||
return nvc; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.