Пример #1
0
        public void GetReloadToken_ConfigurationChanges_ReturnsNewToken()
        {
            dynamic configurationData = new
            {
                Settings = new
                {
                    Key = "Value",
                },
            };

            using (MockConfiguration configuration = new MockConfiguration(configurationData))
            {
                IChangeToken reloadToken = configuration.GetReloadToken();

                configurationData = new
                {
                    Key = "NewValue",
                };

                configuration.SetConfigurationData(configurationData);

                Assert.True(configuration.GetReloadToken() != reloadToken);
            }
        }
Пример #2
0
        public void GetReloadToken_ConfigurationChanges_ReloadTokenFires()
        {
            dynamic configurationData = new
            {
                Settings = new
                {
                    Key = "Value",
                },
            };

            using (MockConfiguration configuration = new MockConfiguration(configurationData))
            {
                IChangeToken reloadToken = configuration.GetReloadToken();

                configurationData = new
                {
                    Key = "NewValue",
                };

                configuration.SetConfigurationData(configurationData);

                Assert.Equal(actual: reloadToken.HasChanged, expected: true);
            }
        }