summaryrefslogtreecommitdiffstats
path: root/src/DotNetOpenId.Test/UtilTest.cs
diff options
context:
space:
mode:
authorAndrew Arnott <andrewarnott@gmail.com>2008-05-26 12:27:05 -0700
committerAndrew Arnott <andrewarnott@gmail.com>2008-05-26 12:27:05 -0700
commit39cac8615803a6605b1afebc63eb8a901c1bdc2b (patch)
tree5ec99dd47130751cf633f6c3d88e9f2a89ac5533 /src/DotNetOpenId.Test/UtilTest.cs
parent06bfb2d70559c31988bd8cf4e0b3d044c93c3e4d (diff)
downloadDotNetOpenAuth-39cac8615803a6605b1afebc63eb8a901c1bdc2b.zip
DotNetOpenAuth-39cac8615803a6605b1afebc63eb8a901c1bdc2b.tar.gz
DotNetOpenAuth-39cac8615803a6605b1afebc63eb8a901c1bdc2b.tar.bz2
Fixes handling of query strings starting with ?&.
This required a small fix to Util.NameValueCollectionToDictionary. Fixes Google Code Issue 81. Thanks to richertech for the report and suggested fix.
Diffstat (limited to 'src/DotNetOpenId.Test/UtilTest.cs')
-rw-r--r--src/DotNetOpenId.Test/UtilTest.cs28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/DotNetOpenId.Test/UtilTest.cs b/src/DotNetOpenId.Test/UtilTest.cs
new file mode 100644
index 0000000..2f995c5
--- /dev/null
+++ b/src/DotNetOpenId.Test/UtilTest.cs
@@ -0,0 +1,28 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using NUnit.Framework;
+using System.Web;
+using System.Collections.Specialized;
+
+namespace DotNetOpenId.Test {
+ [TestFixture]
+ public class UtilTest {
+ [Test]
+ public void NameValueCollectionToDictionary() {
+ NameValueCollection nvc = HttpUtility.ParseQueryString("?a=b");
+ IDictionary<string, string> dict = Util.NameValueCollectionToDictionary(nvc);
+ Assert.AreEqual(1, dict.Count);
+ Assert.IsTrue(dict["a"] == "b");
+ }
+
+ [Test]
+ public void NameValueCollectionToDictionaryWithEmptyMemberTest() {
+ // Google Code Issue 81.
+ NameValueCollection nvc = HttpUtility.ParseQueryString("?&a=b");
+ IDictionary<string, string> dict = Util.NameValueCollectionToDictionary(nvc);
+ Assert.IsTrue(dict["a"] == "b");
+ }
+ }
+}