diff options
author | Andrew Arnott <andrewarnott@gmail.com> | 2010-01-22 20:07:20 -0800 |
---|---|---|
committer | Andrew Arnott <andrewarnott@gmail.com> | 2010-01-26 07:05:12 -0800 |
commit | 9617dff693514a5c41d0254700dd71c18f8500ce (patch) | |
tree | 30334d6306eb8627e418d5f8eb956959793c9426 | |
parent | 552e0f13814655312525164f948bca6015287227 (diff) | |
download | DotNetOpenAuth-9617dff693514a5c41d0254700dd71c18f8500ce.zip DotNetOpenAuth-9617dff693514a5c41d0254700dd71c18f8500ce.tar.gz DotNetOpenAuth-9617dff693514a5c41d0254700dd71c18f8500ce.tar.bz2 |
Added missing contracts.
-rw-r--r-- | src/DotNetOpenAuth/OpenId/Realm.cs | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/DotNetOpenAuth/OpenId/Realm.cs b/src/DotNetOpenAuth/OpenId/Realm.cs index 818718a..4137c72 100644 --- a/src/DotNetOpenAuth/OpenId/Realm.cs +++ b/src/DotNetOpenAuth/OpenId/Realm.cs @@ -112,6 +112,8 @@ namespace DotNetOpenAuth.OpenId { public static Realm AutoDetect { get { Contract.Requires<InvalidOperationException>(HttpContext.Current != null && HttpContext.Current.Request != null, MessagingStrings.HttpContextRequired); + Contract.Ensures(Contract.Result<Realm>() != null); + HttpRequestInfo requestInfo = new HttpRequestInfo(HttpContext.Current.Request); UriBuilder realmUrl = new UriBuilder(requestInfo.UrlBeforeRewriting); realmUrl.Path = HttpContext.Current.Request.ApplicationPath; @@ -252,6 +254,7 @@ namespace DotNetOpenAuth.OpenId { [SuppressMessage("Microsoft.Usage", "CA2234:PassSystemUriObjectsInsteadOfStrings", Justification = "Not all Realms are valid URLs.")] [DebuggerStepThrough] public static implicit operator Realm(string uri) { + Contract.Ensures((Contract.Result<Realm>() != null) == (uri != null)); return uri != null ? new Realm(uri) : null; } @@ -262,6 +265,7 @@ namespace DotNetOpenAuth.OpenId { /// <returns>The result of the conversion.</returns> [DebuggerStepThrough] public static implicit operator Realm(Uri uri) { + Contract.Ensures((Contract.Result<Realm>() != null) == (uri != null)); return uri != null ? new Realm(uri) : null; } @@ -272,6 +276,7 @@ namespace DotNetOpenAuth.OpenId { /// <returns>The result of the conversion.</returns> [DebuggerStepThrough] public static implicit operator string(Realm realm) { + Contract.Ensures((Contract.Result<string>() != null) == (realm != null)); return realm != null ? realm.ToString() : null; } |