public void AddBsonClassMap_AddNewBsonClassWithoutBuilding_BsonClassMapIsNotRegistered() { // Arrange var mongoCollectionBuilder = new MongoCollectionBuilder <Order>(_mongoDatabase); // Act mongoCollectionBuilder.AddBsonClassMap <ItemClassMapNotRegistered>(cm => cm.AutoMap()); // Assert Assert.False(BsonClassMap.IsClassMapRegistered(typeof(ItemClassMapNotRegistered))); }
public void AddBsonClassMap_AddNewBsonClassMapOnce_BsonClassMapIsRegistered() { // Arrange var mongoCollectionBuilder = new MongoCollectionBuilder <Order>(_mongoDatabase); // Act mongoCollectionBuilder.AddBsonClassMap <Order>(cm => cm.AutoMap()); IMongoCollection <Order> result = mongoCollectionBuilder.Build(); // Assert Assert.True(BsonClassMap.IsClassMapRegistered(typeof(Order))); }
public void AddBsonClassMap_AddNewBsonClassMapWithoutParameter_BsonClassMapIsRegistered() { // Arrange var mongoCollectionBuilder = new MongoCollectionBuilder <ItemWithoutSpecificClassMap>(_mongoDatabase); // Act mongoCollectionBuilder.AddBsonClassMap <ItemWithoutSpecificClassMap>(); IMongoCollection <ItemWithoutSpecificClassMap> result = mongoCollectionBuilder.Build(); // Assert Assert.NotNull(result); Assert.True(BsonClassMap.IsClassMapRegistered(typeof(ItemWithoutSpecificClassMap))); }