forked from samus/mongodb-csharp
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
63 additions
and
1 deletion.
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
61 changes: 61 additions & 0 deletions
61
source/MongoDB.Tests/UnitTests/Configuration/MongoConfigurationTests.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,61 @@ | ||
using System; | ||
using MongoDB.Configuration; | ||
using NUnit.Framework; | ||
|
||
namespace MongoDB.UnitTests.Configuration | ||
{ | ||
[TestFixture] | ||
public class MongoConfigurationTests | ||
{ | ||
[Test] | ||
public void IsModifiableByDefault() | ||
{ | ||
var config = new MongoConfiguration(); | ||
Assert.IsTrue(config.IsModifiable); | ||
} | ||
|
||
[Test] | ||
public void IsNotModifiableAfterValidate() | ||
{ | ||
var config = new MongoConfiguration(); | ||
config.ValidateAndSeal(); | ||
Assert.IsFalse(config.IsModifiable); | ||
} | ||
|
||
[Test] | ||
[ExpectedException(typeof(InvalidOperationException))] | ||
public void CanNotChangeConnectionStringAfterValidate() | ||
{ | ||
var config = new MongoConfiguration(); | ||
config.ValidateAndSeal(); | ||
config.ConnectionString = ""; | ||
} | ||
|
||
[Test] | ||
[ExpectedException(typeof(InvalidOperationException))] | ||
public void CanNotChangeMappingStoreAfterValidate() | ||
{ | ||
var config = new MongoConfiguration(); | ||
config.ValidateAndSeal(); | ||
config.MappingStore = null; | ||
} | ||
|
||
[Test] | ||
[ExpectedException(typeof(InvalidOperationException))] | ||
public void CanNotChangeReadLocalTimeAfterValidate() | ||
{ | ||
var config = new MongoConfiguration(); | ||
config.ValidateAndSeal(); | ||
config.ReadLocalTime = true; | ||
} | ||
|
||
[Test] | ||
[ExpectedException(typeof(InvalidOperationException))] | ||
public void CanNotChangeSerializationFactoryAfterValidate() | ||
{ | ||
var config = new MongoConfiguration(); | ||
config.ValidateAndSeal(); | ||
config.SerializationFactory = null; | ||
} | ||
} | ||
} |