Ejemplo n.º 1
0
        public async Task Remote(string env)
        {
            var databaseOption = new DBConnectOptions
            {
                ConnectionString = this.GetRandom(),
                Name             = this.GetRandom(),
                Provider         = this.GetRandom(),
            };

            var dic = new Dictionary <string, object>
            {
                { DBConnectOptions.Option, databaseOption }
            };

            await this.SetConfigAsync(ConfigPath, dic);

            var remoteOptions = new SAEOptions
            {
                Url          = ConfigPath,
                Client       = this._client,
                PollInterval = PollInterval
            };

            var root = this.GetConfigurationBuilder(env).AddRemoteSource(remoteOptions).Build();

            var configurationSection = root.GetSection(DBConnectOptions.Option);

            var options = configurationSection.Get <DBConnectOptions>();

            this.Eq(databaseOption, options);


            databaseOption.Provider         = this.GetRandom();
            databaseOption.ConnectionString = this.GetRandom();

            await this.SetConfigAsync(ConfigPath, dic);

            Thread.Sleep((int)(remoteOptions.PollInterval * 1200));

            options = configurationSection.Get <DBConnectOptions>();

            this.Eq(databaseOption, options);
        }
Ejemplo n.º 2
0
 private void Eq(DBConnectOptions left, DBConnectOptions right)
 {
     Xunit.Assert.Equal(left.ConnectionString, right.ConnectionString);
     Xunit.Assert.Equal(left.Name, right.Name);
     Xunit.Assert.Equal(left.Provider, right.Provider);
 }