Example #1
0
        public void ConfigurationStore_GetValue_Test()
        {
            var optionsBuilder = new DbContextOptionsBuilder <DatabaseContext>();

            optionsBuilder.UseSqlite($"Data Source={Path.GetTempFileName()}");
            var configStore = new ConfigurationCollectionStore(optionsBuilder);
            var config      = configStore
                              .CreateConfiguration <ExampleConfigurationCollection>("TestConfiguration");
            var setValue = config.ValueCollection[config.Configuration.ExampleConfiguration.Descriptor,
                                                  nameof(config.Configuration.ExampleConfiguration.FullscreenResolution)];

            config.Configuration.ExampleConfiguration.FullscreenResolution
                = Configuration.FullscreenResolution.Resolution3840X2160;
            configStore.UpdateConfiguration(config);
            var getValue = configStore.GetValue(setValue.Guid);

            Assert.Equal(setValue.Value, (Configuration.FullscreenResolution)getValue.Value);
        }