public void verify_migration_ignore_duplication_errors_reverse_error() { _collection.InsertOne(BsonDocument.Parse(@"{ ""_id"" : ""A200"", ""Id"" : ""Test_1"" }")); ///This error conflict with the following one. is an error we cannot fix. _collection.InsertOne(BsonDocument.Parse(@"{ ""_id"" : ""a300"", ""Id"" : ""Test_3"" }")); _collection.InsertOne(BsonDocument.Parse(@"{ ""_id"" : ""A300"", ""Id"" : ""Test_2"" }")); TestLogger testLogger = new TestLogger(); sut = new TestIdentityAssociation(_db, testLogger, true, false); //Database should be converted. var document = _collection.FindOneById("A200"); Assert.That(document["OriginalKey"].AsString, Is.EqualTo("A200")); //The record with A300 cannot be converted, because it will conflict with the a300 lowercase. This can be //a problem, but we cannot do anything. document = _collection.FindOneById("a300"); Assert.That(document["OriginalKey"].AsString, Is.EqualTo("a300")); Assert.That(document["Id"].AsString, Is.EqualTo("Test_3")); document = _collection.FindOneById("A300"); Assert.That(document["OriginalKey"].AsString, Is.EqualTo("A300")); Assert.That(document["Id"].AsString, Is.EqualTo("Test_2")); Assert.That(testLogger.ErrorCount, Is.EqualTo(0)); //No log error Assert.That(_collection.Count(Builders <BsonDocument> .Filter.Empty), Is.EqualTo(3L)); }
public void verify_migration_base() { _collection.InsertOne(BsonDocument.Parse(@"{ ""_id"" : ""a200"", ""Id"" : ""Test_1"" }")); _collection.InsertOne(BsonDocument.Parse(@"{ ""_id"" : ""A300"", ""Id"" : ""Test_2"" }")); sut = new TestIdentityAssociation(_db, testLogger, true, true); //Database should be converted. var document = _collection.FindOneById("a200"); Assert.That(document["OriginalKey"].AsString, Is.EqualTo("a200")); document = _collection.FindOneById("a300"); Assert.That(document["OriginalKey"].AsString, Is.EqualTo("A300")); Assert.That(_collection.Count(Builders <BsonDocument> .Filter.Empty), Is.EqualTo(2L)); }
public void SetUp() { _db.Drop(); sut = new TestIdentityAssociation(_db, testLogger, false, caseInsensitive: false); }
public void SetUp() { _db.Drop(); uniqueIdSut = new TestIdentityAssociation(_db, testLogger, false, true); }
public void SetUp() { _db.Drop(); sut = new TestIdentityAssociation(_db, testLogger, true, true); }
public void SetUp() { _db.Drop(); sut = new TestIdentityAssociation(_db); uniqueIdSut = new TestIdentityAssociationWithUniqueId(_db); }