public void ConfigurationStore_Delete_Test() { var optionsBuilder = new DbContextOptionsBuilder <DatabaseContext>(); optionsBuilder.UseSqlite($"Data Source={Path.GetTempFileName()}"); var configStore = new ConfigurationCollectionStore(optionsBuilder); var config = configStore .CreateConfiguration <ExampleConfigurationCollection>("TestConfiguration"); // trigger an ensure of the ExampleConfiguration var getConfig = configStore.GetConfiguration <ExampleConfigurationCollection>(config.ValueCollection.Guid); Assert.NotNull(getConfig); configStore.DeleteConfiguration(config.ValueCollection.Guid); Assert.Null(configStore.GetConfiguration <ExampleConfigurationCollection>(config.ValueCollection.Guid)); }
public void ConfigurationStoreSetIndividual_Test() { var optionsBuilder = new DbContextOptionsBuilder <DatabaseContext>(); optionsBuilder.UseSqlite($"Data Source={Path.GetTempFileName()}"); var store = new ConfigurationCollectionStore(optionsBuilder); var configCollection = store.CreateConfiguration <ExampleConfigurationCollection>("Test"); configCollection.Configuration.ExampleConfiguration.ISOPath0 = "TestEqual"; configCollection.Configuration.ExampleConfiguration.FullscreenResolution = FullscreenResolution.Resolution1152X648; configCollection.Configuration.ExampleConfiguration.Fullscreen = false; store.UpdateConfiguration(configCollection); configCollection.Configuration.ExampleConfiguration.FullscreenResolution = FullscreenResolution.Resolution1280X768; store.UpdateValue(configCollection.Configuration.ExampleConfiguration.Values["FullscreenResolution"]); var retrievedConfig = store.GetConfiguration <ExampleConfigurationCollection>(configCollection.ValueCollection.Guid); Assert.NotNull(retrievedConfig); Assert.Equal(configCollection.Configuration.ExampleConfiguration.ISOPath0, retrievedConfig.Configuration.ExampleConfiguration.ISOPath0); Assert.Equal(configCollection.Configuration.ExampleConfiguration.FullscreenResolution, retrievedConfig.Configuration.ExampleConfiguration.FullscreenResolution); Assert.Equal(configCollection.Configuration.ExampleConfiguration.Fullscreen, retrievedConfig.Configuration.ExampleConfiguration.Fullscreen); }
public void ConfigurationStore_CreateAndRetrieve_Test() { var optionsBuilder = new DbContextOptionsBuilder <DatabaseContext>(); optionsBuilder.UseSqlite($"Data Source={Path.GetTempFileName()}"); var configStore = new ConfigurationCollectionStore(optionsBuilder); var gameGuid = Guid.NewGuid(); var config = configStore .CreateConfiguration <ExampleConfigurationCollection>("TestConfiguration"); var retrieved = configStore.GetConfiguration <ExampleConfigurationCollection> (config.ValueCollection.Guid); }
public void ConfigurationStore_CreateAndRetrieveEnsure_Test() { var optionsBuilder = new DbContextOptionsBuilder <DatabaseContext>(); optionsBuilder.UseSqlite($"Data Source={Path.GetTempFileName()}"); var configStore = new ConfigurationCollectionStore(optionsBuilder); var gameGuid = Guid.NewGuid(); var config = configStore .CreateConfiguration <ExampleConfigurationCollection>("TestConfiguration"); // trigger an ensure of the ExampleConfiguration var res = config.Configuration.ExampleConfiguration.FullscreenResolution; configStore.UpdateConfiguration(config); var retrieved = configStore.GetConfiguration <ExampleConfigurationCollection> (config.ValueCollection.Guid); }
public void ConfigurationStoreGetDefault_Test() { var optionsBuilder = new DbContextOptionsBuilder <DatabaseContext>(); optionsBuilder.UseSqlite($"Data Source={Path.GetTempFileName()}"); var store = new ConfigurationCollectionStore(optionsBuilder); var configCollection = store.CreateConfiguration <ExampleConfigurationCollection>("Test"); var retrievedConfig = store.GetConfiguration <ExampleConfigurationCollection>(configCollection.ValueCollection.Guid); Assert.NotNull(retrievedConfig); Assert.Equal(configCollection.Configuration.ExampleConfiguration.ISOPath0, retrievedConfig.Configuration.ExampleConfiguration.ISOPath0); Assert.Equal(configCollection.Configuration.ExampleConfiguration.FullscreenResolution, retrievedConfig.Configuration.ExampleConfiguration.FullscreenResolution); Assert.Equal(configCollection.Configuration.ExampleConfiguration.Fullscreen, retrievedConfig.Configuration.ExampleConfiguration.Fullscreen); }
public void ConfigurationStore_ValueConsistency_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); // trigger an ensure of the ExampleConfiguration var getConfig = configStore.GetConfiguration <ExampleConfigurationCollection>(config.ValueCollection.Guid); Assert.Equal(setValue.Value, getConfig.ValueCollection[setValue.Guid].value.Value); }