private static MongoDbContextData CreateContext(MongoResource mongoResource)
        {
            var mongoOptions = new MongoOptions
            {
                ConnectionString = mongoResource.ConnectionString,
                DatabaseName     = mongoResource.CreateDatabase().DatabaseNamespace.DatabaseName
            };
            var builder = new MongoDatabaseBuilder(mongoOptions);

            builder.RegisterImmutableConventionPack();
            return(builder.Build());
        }
        public void RegisterImmutableConventionPack_RegisteredSuccessfully()
        {
            // Arrange
            var mongoDatabaseBuilder = new MongoDatabaseBuilder(_mongoOptions);

            mongoDatabaseBuilder.RegisterImmutableConventionPack();

            // Act
            mongoDatabaseBuilder.Build();

            // Assert
            IEnumerable <IConvention> conventions = ConventionRegistry.Lookup(typeof(string)).Conventions;

            Assert.NotNull(conventions.OfType <ImmutableConvention>().FirstOrDefault());
            Assert.NotNull(conventions.OfType <IgnoreExtraElementsConvention>().FirstOrDefault());
        }