summaryrefslogtreecommitdiffstats
path: root/src/DotNetOpenAuth.Test
diff options
context:
space:
mode:
authorAndrew Arnott <andrewarnott@gmail.com>2009-04-17 06:21:53 -0700
committerAndrew Arnott <andrewarnott@gmail.com>2009-04-17 06:21:53 -0700
commit15b970d69eda022112f4ee247de69f34f39d4f47 (patch)
tree44064dea4fcfdc85df93b8eab21493a36023c2c9 /src/DotNetOpenAuth.Test
parent0cf61f17c975511d56e5584a8da4f1afec250143 (diff)
downloadDotNetOpenAuth-15b970d69eda022112f4ee247de69f34f39d4f47.zip
DotNetOpenAuth-15b970d69eda022112f4ee247de69f34f39d4f47.tar.gz
DotNetOpenAuth-15b970d69eda022112f4ee247de69f34f39d4f47.tar.bz2
Fixed Identifier.TryParse to not throw when passed null or empty string values.
Fixes Trac issue 15.
Diffstat (limited to 'src/DotNetOpenAuth.Test')
-rw-r--r--src/DotNetOpenAuth.Test/OpenId/IdentifierTests.cs16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/DotNetOpenAuth.Test/OpenId/IdentifierTests.cs b/src/DotNetOpenAuth.Test/OpenId/IdentifierTests.cs
index 2b012dd..53df6c8 100644
--- a/src/DotNetOpenAuth.Test/OpenId/IdentifierTests.cs
+++ b/src/DotNetOpenAuth.Test/OpenId/IdentifierTests.cs
@@ -19,6 +19,22 @@ namespace DotNetOpenAuth.Test.OpenId {
private string xri = "=arnott*andrew";
[TestMethod]
+ public void TryParseNoThrow() {
+ Identifier id;
+ Assert.IsFalse(Identifier.TryParse(null, out id));
+ Assert.IsFalse(Identifier.TryParse("", out id));
+ }
+
+ [TestMethod]
+ public void TryParse() {
+ Identifier id;
+ Assert.IsTrue(Identifier.TryParse("http://host/path", out id));
+ Assert.AreEqual("http://host/path", id.ToString());
+ Assert.IsTrue(Identifier.TryParse("=arnott", out id));
+ Assert.AreEqual("=arnott", id.ToString());
+ }
+
+ [TestMethod]
public void Parse() {
Assert.IsInstanceOfType(Identifier.Parse(this.uri), typeof(UriIdentifier));
Assert.IsInstanceOfType(Identifier.Parse(this.xri), typeof(XriIdentifier));