コード例 #1
0
        public void UpdateConfiguration_WithNullMongoDbServiceInfo_ReturnsExpected()
        {
            var configurer = new MongoDbProviderConfigurer();
            var config = new MongoDbConnectorOptions()
            {
                Server = "localhost",
                Port = 1234,
                Username = "******",
                Password = "******",
                Database = "database"
            };
            configurer.UpdateConfiguration(null, config);

            Assert.Equal("localhost", config.Server);
            Assert.Equal(1234, config.Port);
            Assert.Equal("username", config.Username);
            Assert.Equal("password", config.Password);
            Assert.Equal("database", config.Database);
            Assert.Null(config.ConnectionString);
        }
コード例 #2
0
        public void UpdateConfiguration_WithMongoDbServiceInfo_ReturnsExpected()
        {
            MongoDbProviderConfigurer configurer = new MongoDbProviderConfigurer();
            MongoDbConnectorOptions   config     = new MongoDbConnectorOptions()
            {
                Server   = "localhost",
                Port     = 1234,
                Username = "******",
                Password = "******",
                Database = "database"
            };
            MongoDbServiceInfo si = new MongoDbServiceInfo("MyId", "mongodb://*****:*****@192.168.0.90:27017/cf_b4f8d2fa_a3ea_4e3a_a0e8_2cd040790355");

            configurer.UpdateConfiguration(si, config);

            Assert.Equal("192.168.0.90", config.Server);
            Assert.Equal(27017, config.Port);
            Assert.Equal("Dd6O1BPXUHdrmzbP", config.Username);
            Assert.Equal("7E1LxXnlH2hhlPVt", config.Password);
            Assert.Equal("cf_b4f8d2fa_a3ea_4e3a_a0e8_2cd040790355", config.Database);
        }