public void CanNotChangeSerializationFactoryAfterValidate()
        {
            var config = new MongoConfiguration();

            config.ValidateAndSeal();
            config.SerializationFactory = null;
        }
        public void CanNotChangeReadLocalTimeAfterValidate()
        {
            var config = new MongoConfiguration();

            config.ValidateAndSeal();
            config.ReadLocalTime = true;
        }
        public void CanNotChangeMappingStoreAfterValidate()
        {
            var config = new MongoConfiguration();

            config.ValidateAndSeal();
            config.MappingStore = null;
        }
        public void CanNotChangeConnectionStringAfterValidate()
        {
            var config = new MongoConfiguration();

            config.ValidateAndSeal();
            config.ConnectionString = "";
        }
        public void IsNotModifiableAfterValidate()
        {
            var config = new MongoConfiguration();

            config.ValidateAndSeal();
            Assert.IsFalse(config.IsModifiable);
        }
Example #6
0
        /// <summary>
        ///   Initializes a new instance of the <see cref = "Mongo" /> class.
        /// </summary>
        /// <param name = "configuration">The mongo configuration.</param>
        public Mongo(MongoConfiguration configuration)
        {
            if (configuration == null)
            {
                throw new ArgumentNullException("configuration");
            }

            configuration.ValidateAndSeal();

            _configuration = configuration;
            _connection    = ConnectionFactoryFactory.GetConnection(configuration.ConnectionString);
        }