diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/DotNetOpenAuth.Test/AssemblyTesting.cs | 2 | ||||
-rw-r--r-- | src/DotNetOpenAuth.Test/DotNetOpenAuth.Test.csproj | 3 | ||||
-rw-r--r-- | src/DotNetOpenAuth.Test/OpenId/IdentifierTests.cs | 16 | ||||
-rw-r--r-- | src/DotNetOpenAuth/DotNetOpenAuth.csproj | 1 | ||||
-rw-r--r-- | src/DotNetOpenAuth/OpenId/Identifier.cs | 6 | ||||
-rw-r--r-- | src/DotNetOpenAuth/OpenId/RelyingParty/OpenIdAjaxTextBox.cs | 3 |
6 files changed, 28 insertions, 3 deletions
diff --git a/src/DotNetOpenAuth.Test/AssemblyTesting.cs b/src/DotNetOpenAuth.Test/AssemblyTesting.cs index bfce6c6..1d8f521 100644 --- a/src/DotNetOpenAuth.Test/AssemblyTesting.cs +++ b/src/DotNetOpenAuth.Test/AssemblyTesting.cs @@ -19,7 +19,7 @@ namespace DotNetOpenAuth.Test { e.Handled = true; } else { e.Handled = true; - Assert.Fail(e.FailureKind.ToString() + ": " + e.DebugMessage); + Assert.Fail(e.FailureKind.ToString() + ": " + e.Message); } }; } diff --git a/src/DotNetOpenAuth.Test/DotNetOpenAuth.Test.csproj b/src/DotNetOpenAuth.Test/DotNetOpenAuth.Test.csproj index b2c4d3a..591c442 100644 --- a/src/DotNetOpenAuth.Test/DotNetOpenAuth.Test.csproj +++ b/src/DotNetOpenAuth.Test/DotNetOpenAuth.Test.csproj @@ -21,7 +21,7 @@ <DefineConstants>DEBUG;TRACE</DefineConstants> <ErrorReport>prompt</ErrorReport> <WarningLevel>4</WarningLevel> - <CodeContractsEnableRuntimeChecking>True</CodeContractsEnableRuntimeChecking> + <CodeContractsEnableRuntimeChecking>False</CodeContractsEnableRuntimeChecking> <CodeContractsCustomRewriterAssembly> </CodeContractsCustomRewriterAssembly> <CodeContractsCustomRewriterClass> @@ -43,6 +43,7 @@ <CodeContractsUseBaseLine>False</CodeContractsUseBaseLine> <CodeContractsRunInBackground>True</CodeContractsRunInBackground> <CodeContractsShowSquigglies>False</CodeContractsShowSquigglies> + <CodeContractsRuntimeOnlyPublicSurface>False</CodeContractsRuntimeOnlyPublicSurface> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> <DebugType>pdbonly</DebugType> 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)); diff --git a/src/DotNetOpenAuth/DotNetOpenAuth.csproj b/src/DotNetOpenAuth/DotNetOpenAuth.csproj index 2c30aaf..e2894cf 100644 --- a/src/DotNetOpenAuth/DotNetOpenAuth.csproj +++ b/src/DotNetOpenAuth/DotNetOpenAuth.csproj @@ -47,6 +47,7 @@ <CodeContractsRunInBackground>True</CodeContractsRunInBackground> <CodeContractsShowSquigglies>True</CodeContractsShowSquigglies> <CodeContractsArithmeticObligations>False</CodeContractsArithmeticObligations> + <CodeContractsRuntimeOnlyPublicSurface>False</CodeContractsRuntimeOnlyPublicSurface> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> <DebugType>pdbonly</DebugType> diff --git a/src/DotNetOpenAuth/OpenId/Identifier.cs b/src/DotNetOpenAuth/OpenId/Identifier.cs index 53f5094..1b9570e 100644 --- a/src/DotNetOpenAuth/OpenId/Identifier.cs +++ b/src/DotNetOpenAuth/OpenId/Identifier.cs @@ -114,7 +114,11 @@ namespace DotNetOpenAuth.OpenId { /// True if the operation was successful. False if the string was not a valid OpenId Identifier. /// </returns> public static bool TryParse(string value, out Identifier result) { - Contract.Requires(!string.IsNullOrEmpty(value)); + if (string.IsNullOrEmpty(value)) { + result = null; + return false; + } + if (IsValid(value)) { result = Parse(value); return true; diff --git a/src/DotNetOpenAuth/OpenId/RelyingParty/OpenIdAjaxTextBox.cs b/src/DotNetOpenAuth/OpenId/RelyingParty/OpenIdAjaxTextBox.cs index 561706a..bb3e49b 100644 --- a/src/DotNetOpenAuth/OpenId/RelyingParty/OpenIdAjaxTextBox.cs +++ b/src/DotNetOpenAuth/OpenId/RelyingParty/OpenIdAjaxTextBox.cs @@ -1298,6 +1298,9 @@ if (!openidbox.dnoi_internal.onSubmit()) {{ return false; }} this.OnUnconfirmedPositiveAssertion(); foreach (var pair in this.clientScriptExtensions) { IClientScriptExtensionResponse extension = (IClientScriptExtensionResponse)authResponse.GetExtension(pair.Key); + if (extension == null) { + continue; + } var positiveResponse = (PositiveAuthenticationResponse)authResponse; string js = extension.InitializeJavaScriptData(positiveResponse.Response); if (string.IsNullOrEmpty(js)) { |