diff options
author | Andrew Arnott <andrewarnott@gmail.com> | 2011-08-15 22:02:43 -0700 |
---|---|---|
committer | Andrew Arnott <andrewarnott@gmail.com> | 2011-08-15 22:02:43 -0700 |
commit | cabe9ad70ef14f86088e482b129c54c18c06d276 (patch) | |
tree | 281bd842778d612e094bb9177dea676a9104ec3b | |
parent | 890bf0c250bdcb57c48e8121f8308e8bdd045cb6 (diff) | |
download | DotNetOpenAuth-cabe9ad70ef14f86088e482b129c54c18c06d276.zip DotNetOpenAuth-cabe9ad70ef14f86088e482b129c54c18c06d276.tar.gz DotNetOpenAuth-cabe9ad70ef14f86088e482b129c54c18c06d276.tar.bz2 |
Fixed a bug in configuration section handling that caused even simple unit tests to fail.
4 files changed, 12 insertions, 5 deletions
diff --git a/src/DotNetOpenAuth.Messaging/Configuration/DotNetOpenAuthSection.cs b/src/DotNetOpenAuth.Messaging/Configuration/DotNetOpenAuthSection.cs index af9d45b..87e335c 100644 --- a/src/DotNetOpenAuth.Messaging/Configuration/DotNetOpenAuthSection.cs +++ b/src/DotNetOpenAuth.Messaging/Configuration/DotNetOpenAuthSection.cs @@ -41,7 +41,8 @@ namespace DotNetOpenAuth.Configuration { public static DotNetOpenAuthSection Configuration { get { Contract.Ensures(Contract.Result<DotNetOpenAuthSection>() != null); - return (DotNetOpenAuthSection)ConfigurationManager.GetSection(SectionName) ?? new DotNetOpenAuthSection(); + var configuration = ConfigurationManager.OpenExeConfiguration(null); + return (DotNetOpenAuthSection)configuration.GetSectionGroup(SectionName); } } diff --git a/src/DotNetOpenAuth.Messaging/Configuration/MessagingElement.cs b/src/DotNetOpenAuth.Messaging/Configuration/MessagingElement.cs index 42ab0eb..397c97d 100644 --- a/src/DotNetOpenAuth.Messaging/Configuration/MessagingElement.cs +++ b/src/DotNetOpenAuth.Messaging/Configuration/MessagingElement.cs @@ -68,7 +68,7 @@ namespace DotNetOpenAuth.Configuration { /// <summary> /// The name of the <messaging> sub-element. /// </summary> - private const string MessagingElementName = DotNetOpenAuthSection.SectionName + "/messaging"; + private const string MessagingElementName = "messaging"; /// <summary> /// Gets the configuration section from the .config file. @@ -76,7 +76,7 @@ namespace DotNetOpenAuth.Configuration { public static MessagingElement Configuration { get { Contract.Ensures(Contract.Result<MessagingElement>() != null); - return (MessagingElement)ConfigurationManager.GetSection(MessagingElementName) ?? new MessagingElement(); + return (MessagingElement)DotNetOpenAuthSection.Configuration.Sections[MessagingElementName] ?? new MessagingElement(); } } @@ -200,6 +200,7 @@ namespace DotNetOpenAuth.Configuration { /// <value> /// The embedded resource retrieval provider. /// </value> + [ConfigurationProperty(WebResourceUrlProviderName)] internal TypeConfigurationElement<IEmbeddedResourceRetrieval> EmbeddedResourceRetrievalProvider { get { return (TypeConfigurationElement<IEmbeddedResourceRetrieval>)this[WebResourceUrlProviderName] ?? new TypeConfigurationElement<IEmbeddedResourceRetrieval>(); } set { this[WebResourceUrlProviderName] = value; } diff --git a/src/DotNetOpenAuth.Messaging/Configuration/ReportingElement.cs b/src/DotNetOpenAuth.Messaging/Configuration/ReportingElement.cs index a8eb7d3..4011ba5 100644 --- a/src/DotNetOpenAuth.Messaging/Configuration/ReportingElement.cs +++ b/src/DotNetOpenAuth.Messaging/Configuration/ReportingElement.cs @@ -77,7 +77,7 @@ namespace DotNetOpenAuth.Configuration { public static ReportingElement Configuration { get { Contract.Ensures(Contract.Result<ReportingElement>() != null); - return (ReportingElement)ConfigurationManager.GetSection(ReportingElementName) ?? new ReportingElement(); + return (ReportingElement)DotNetOpenAuthSection.Configuration.Sections[ReportingElementName] ?? new ReportingElement(); } } diff --git a/src/DotNetOpenAuth.Test/App.config b/src/DotNetOpenAuth.Test/App.config index b3da723..56c3ecd 100644 --- a/src/DotNetOpenAuth.Test/App.config +++ b/src/DotNetOpenAuth.Test/App.config @@ -2,7 +2,12 @@ <configuration> <configSections> <section name="uri" type="System.Configuration.UriSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/> - <section name="dotNetOpenAuth" type="DotNetOpenAuth.Configuration.DotNetOpenAuthSection, DotNetOpenAuth"/> + <sectionGroup name="dotNetOpenAuth" type="DotNetOpenAuth.Configuration.DotNetOpenAuthSection, DotNetOpenAuth.Messaging"> + <section name="openid" type="DotNetOpenAuth.Configuration.OpenIdElement, DotNetOpenAuth.OpenId" requirePermission="false" allowLocation="true" /> + <section name="oauth" type="DotNetOpenAuth.Configuration.OAuthElement, DotNetOpenAuth.OAuth" requirePermission="false" allowLocation="true" /> + <section name="messaging" type="DotNetOpenAuth.Configuration.MessagingElement, DotNetOpenAuth.Messaging" requirePermission="false" allowLocation="true" /> + <section name="reporting" type="DotNetOpenAuth.Configuration.ReportingElement, DotNetOpenAuth.Messaging" requirePermission="false" allowLocation="true" /> + </sectionGroup> </configSections> <!-- The uri section is necessary to turn on .NET 3.5 support for IDN (international domain names), |