diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/DotNetOpenAuth/Configuration/DotNetOpenAuthSection.cs | 45 |
1 files changed, 36 insertions, 9 deletions
diff --git a/src/DotNetOpenAuth/Configuration/DotNetOpenAuthSection.cs b/src/DotNetOpenAuth/Configuration/DotNetOpenAuthSection.cs index aa956d1..117a542 100644 --- a/src/DotNetOpenAuth/Configuration/DotNetOpenAuthSection.cs +++ b/src/DotNetOpenAuth/Configuration/DotNetOpenAuthSection.cs @@ -51,7 +51,10 @@ namespace DotNetOpenAuth.Configuration { /// Gets the configuration section from the .config file. /// </summary> public static DotNetOpenAuthSection Configuration { - get { return (DotNetOpenAuthSection)ConfigurationManager.GetSection(SectionName) ?? new DotNetOpenAuthSection(); } + get { + Contract.Ensures(Contract.Result<DotNetOpenAuthSection>() != null); + return (DotNetOpenAuthSection)ConfigurationManager.GetSection(SectionName) ?? new DotNetOpenAuthSection(); + } } /// <summary> @@ -59,8 +62,14 @@ namespace DotNetOpenAuth.Configuration { /// </summary> [ConfigurationProperty(MessagingElementName)] public MessagingElement Messaging { - get { return (MessagingElement)this[MessagingElementName] ?? new MessagingElement(); } - set { this[MessagingElementName] = value; } + get { + Contract.Ensures(Contract.Result<MessagingElement>() != null); + return (MessagingElement)this[MessagingElementName] ?? new MessagingElement(); + } + + set { + this[MessagingElementName] = value; + } } /// <summary> @@ -68,8 +77,14 @@ namespace DotNetOpenAuth.Configuration { /// </summary> [ConfigurationProperty(OpenIdElementName)] internal OpenIdElement OpenId { - get { return (OpenIdElement)this[OpenIdElementName] ?? new OpenIdElement(); } - set { this[OpenIdElementName] = value; } + get { + Contract.Ensures(Contract.Result<OpenIdElement>() != null); + return (OpenIdElement)this[OpenIdElementName] ?? new OpenIdElement(); + } + + set { + this[OpenIdElementName] = value; + } } /// <summary> @@ -77,8 +92,14 @@ namespace DotNetOpenAuth.Configuration { /// </summary> [ConfigurationProperty(OAuthElementName)] internal OAuthElement OAuth { - get { return (OAuthElement)this[OAuthElementName] ?? new OAuthElement(); } - set { this[OAuthElementName] = value; } + get { + Contract.Ensures(Contract.Result<OAuthElement>() != null); + return (OAuthElement)this[OAuthElementName] ?? new OAuthElement(); + } + + set { + this[OAuthElementName] = value; + } } /// <summary> @@ -86,8 +107,14 @@ namespace DotNetOpenAuth.Configuration { /// </summary> [ConfigurationProperty(ReportingElementName)] internal ReportingElement Reporting { - get { return (ReportingElement)this[ReportingElementName] ?? new ReportingElement(); } - set { this[ReportingElementName] = value; } + get { + Contract.Ensures(Contract.Result<ReportingElement>() != null); + return (ReportingElement)this[ReportingElementName] ?? new ReportingElement(); + } + + set { + this[ReportingElementName] = value; + } } } } |