public void ConfigureByFileAndDelegateFact()
        {
            var originUrl      = "http://origin.url";
            var newUrl         = "http://new.url";
            var appName        = "AppName";
            var newAppName     = "NewAppName";
            var configProvider = new ReloadableMemoryProvider();

            configProvider.Set("Azure:SignalR:ConnectionString", $"Endpoint={originUrl};AccessKey={AccessKey};Version=1.0;");
            var services = new ServiceCollection()
                           .Configure <ServiceManagerOptions>(o =>
            {
                o.ApplicationName = appName;
            })
                           .AddSignalRServiceManager()
                           .AddSingleton <IConfiguration>(new ConfigurationBuilder().Add(new ReloadableMemorySource(configProvider)).Build());

            using var serviceProvider = services.BuildServiceProvider();
            var contextMonitor = serviceProvider.GetRequiredService <IOptionsMonitor <ServiceManagerOptions> >();

            Assert.Equal(appName, contextMonitor.CurrentValue.ApplicationName);

            configProvider.Set("Azure:SignalR:ConnectionString", $"Endpoint={newUrl};AccessKey={AccessKey};Version=1.0;");
            Assert.Equal(appName, contextMonitor.CurrentValue.ApplicationName);  // configuration via delegate is conserved after reload config.
            Assert.Equal(newUrl, new ServiceEndpoint(contextMonitor.CurrentValue.ConnectionString).Endpoint);

            configProvider.Set("Azure:SignalR:ApplicationName", newAppName);
            Assert.Equal(newAppName, contextMonitor.CurrentValue.ApplicationName);
        }
        public void MemoryConfigHotReloadTest()
        {
            var originUrl      = "http://origin.url";
            var newUrl         = "http://new.url";
            var configProvider = new ReloadableMemoryProvider();

            configProvider.Set("Azure:SignalR:ConnectionString", $"Endpoint={originUrl};AccessKey={AccessKey};Version=1.0;");
            var services = new ServiceCollection()
                           .AddSignalRServiceManager()
                           .AddSingleton <IConfiguration>(new ConfigurationBuilder().Add(new ReloadableMemorySource(configProvider)).Build());

            using var provider = services.BuildServiceProvider();
            var optionsMonitor = provider.GetRequiredService <IOptionsMonitor <ServiceOptions> >();

            Assert.Equal(originUrl, new ServiceEndpoint(optionsMonitor.CurrentValue.ConnectionString).Endpoint);

            //update
            configProvider.Set("Azure:SignalR:ConnectionString", $"Endpoint={newUrl};AccessKey={AccessKey};Version=1.0;");
            Assert.Equal(newUrl, new ServiceEndpoint(optionsMonitor.CurrentValue.ConnectionString).Endpoint);
        }