forked from samus/mongodb-csharp
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Change default configuration section name to mongo instead of Mongo w…
…hich match the nameingconventions in app.config files.
- Loading branch information
Showing
6 changed files
with
116 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<configuration> | ||
<configSections> | ||
<section name="Mongo" type="MongoDB.Configuration.MongoConfigurationSection, MongoDB" /> | ||
</configSections> | ||
<Mongo> | ||
<connections> | ||
<add key="local21018" connectionString="Server=localhost:27018" /> | ||
<add key="auth" connectionString="Server=localhost:27019" /> | ||
<add key="default" /> | ||
<add key="tests" connectionString="Server=localhost:27017" /> | ||
</connections> | ||
</Mongo> | ||
<appSettings> | ||
<add key="tests" value="Server=localhost:27017" /> | ||
<add key="auth" value="Server=localhost:27018" /> | ||
<add key="ClientSettingsProvider.ServiceUri" value="" /> | ||
</appSettings> | ||
<system.web> | ||
<membership defaultProvider="ClientAuthenticationMembershipProvider"> | ||
<providers> | ||
<add name="ClientAuthenticationMembershipProvider" type="System.Web.ClientServices.Providers.ClientFormsAuthenticationMembershipProvider, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" serviceUri="" /> | ||
</providers> | ||
</membership> | ||
<roleManager defaultProvider="ClientRoleProvider" enabled="true"> | ||
<providers> | ||
<add name="ClientRoleProvider" type="System.Web.ClientServices.Providers.ClientRoleProvider, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" serviceUri="" cacheTimeout="86400" /> | ||
</providers> | ||
</roleManager> | ||
</system.web> | ||
</configuration> |
39 changes: 39 additions & 0 deletions
39
source/MongoDB.Tests/UnitTests/Configuration/ConfigurationSectionTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
using System.Configuration; | ||
using System.IO; | ||
using MongoDB.Configuration; | ||
using NUnit.Framework; | ||
|
||
namespace MongoDB.UnitTests.Configuration | ||
{ | ||
[TestFixture] | ||
public class ConfigurationSectionTests | ||
{ | ||
private static MongoConfigurationSection ReadFromFile(string name) | ||
{ | ||
return ReadFromFile(name, MongoConfigurationSection.DefaultSectionName); | ||
} | ||
|
||
private static MongoConfigurationSection ReadFromFile(string name, string section) | ||
{ | ||
var map = new ExeConfigurationFileMap {ExeConfigFilename = Path.Combine("Test-Sections", name)}; | ||
var exeConfiguration = ConfigurationManager.OpenMappedExeConfiguration(map, ConfigurationUserLevel.None); | ||
return exeConfiguration.GetSection(section) as MongoConfigurationSection; | ||
} | ||
|
||
[Test] | ||
public void CanReadDefaultFromTestsConfig() | ||
{ | ||
var config = MongoConfigurationSection.GetSection(); | ||
Assert.IsNotNull(config); | ||
Assert.AreEqual("Server=localhost:27017", config.Connections["default"].ConnectionString); | ||
} | ||
|
||
[Test] | ||
public void CanReadlocal21018FromTestsConfig() | ||
{ | ||
var config = MongoConfigurationSection.GetSection(); | ||
Assert.IsNotNull(config); | ||
Assert.AreEqual("Server=localhost:27018", config.Connections["local21018"].ConnectionString); | ||
} | ||
} | ||
} |
23 changes: 0 additions & 23 deletions
23
source/MongoDB.Tests/UnitTests/Configuration/TestConfigurationSection.cs
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters