public void WithMongoCollectionSettings_DefaultCollectionSettingsConfigured_DefaultMongoCollectionSettingsSet() { // Arrange var mongoCollectionBuilder = new MongoCollectionBuilder <Order>(_mongoDatabase); var mongoCollectionSettings = new MongoCollectionSettings(); // Act mongoCollectionBuilder.WithCollectionSettings(sd => { }); IMongoCollection <Order> result = mongoCollectionBuilder.Build(); // Assert Assert.Equal(WriteConcern.Acknowledged, result.Settings.WriteConcern); Assert.Equal(ReadConcern.Majority, result.Settings.ReadConcern); Assert.Equal(ReadPreference.Primary, result.Settings.ReadPreference); Assert.True(result.Settings.AssignIdOnInsert); }
public void WithMongoCollectionSettings_ChangeCollectionSettings_MongoCollectionSettingsChangedSuccessfully() { // Arrange var mongoCollectionBuilder = new MongoCollectionBuilder <Order>(_mongoDatabase); // Act mongoCollectionBuilder.WithCollectionSettings(mongoCollectionSettings => { mongoCollectionSettings.WriteConcern = WriteConcern.Unacknowledged; mongoCollectionSettings.ReadConcern = ReadConcern.Linearizable; mongoCollectionSettings.ReadPreference = ReadPreference.Nearest; mongoCollectionSettings.AssignIdOnInsert = false; }); IMongoCollection <Order> result = mongoCollectionBuilder.Build(); // Assert Assert.Equal(WriteConcern.Unacknowledged, result.Settings.WriteConcern); Assert.Equal(ReadConcern.Linearizable, result.Settings.ReadConcern); Assert.Equal(ReadPreference.Nearest, result.Settings.ReadPreference); Assert.False(result.Settings.AssignIdOnInsert); }