Exemple #1
0
        public void GivenZeroProvider_EventSubscribe_GetMustThrowException()
        {
            var root = new SavableConfigurationRoot(new IConfigurationProvider[0]);

            root.ConfigurationChanged += (_) => { };
            Assert.ThrowsException <InvalidOperationException>(() => root["a"] = "1");
        }
Exemple #2
0
        public void ConfigurationMutEqualInput_MustThrowException()
        {
            var root    = new SavableConfigurationRoot(new IConfigurationProvider[0]);
            var watcher = new EmptyChangeWatcher(root);

            Assert.AreEqual(root, watcher.Configuration);
            watcher.Dispose();
        }
Exemple #3
0
        public void CallCreateEmptyWatcherWithSavableConfig_MustReturnWatcher()
        {
            var config  = new SavableConfigurationRoot(new IConfigurationProvider[0]);
            var watcher = ConfigurationExtensions.CreateEmptyWatcher(config);

            Assert.IsNotNull(watcher);
            watcher = ConfigurationExtensions.CreateEmptyWatcher((IConfiguration)config);
            Assert.IsNotNull(watcher);
        }
Exemple #4
0
        public MainWindow()
        {
            InitializeComponent();
            var builder = new SavableConfiurationBuilder();

            builder.AddJsonFile("app.json", true, true);
            root        = builder.Build();
            DataContext = ProxyHelper.Default.EnsureCreateProxWithAttribute <ThemeService>(root);
            root.BindTwoWay(DataContext, JsonChangeTransferCondition.Instance);
        }
 public MainWindow()
 {
     InitializeComponent();
     root = new ConfigurationBuilder()
            .AddJsonFile("app.json", true, true)
            .BuildSavable();
     GoNormalBind();
     GoProxy();
     KeyDown += MainWindow_KeyDown;
 }
        public Changes()
        {
            var builder = new SavableConfiurationBuilder();

            builder.AddJsonFile("appsettings.json", true, false);
            root          = builder.Build();
            changeWatcher = new ChangeWatcher(root);

            var msbuilder = new ConfigurationBuilder();

            msbuilder.AddJsonFile("appsettings.json", true, false);
            msroot = msbuilder.Build();
        }
Exemple #7
0
        public void CallChangeInfos_MustThrowException()
        {
            var root = new SavableConfigurationRoot(new IConfigurationProvider[0]);

            Assert.ThrowsException <NotSupportedException>(() => new EmptyChangeWatcher(root).ChangeInfos);
        }