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 ConfigurationStoreSet_Test() { var optionsBuilder = new DbContextOptionsBuilder <DatabaseContext>(); optionsBuilder.UseSqlite($"Data Source={Path.GetTempFileName()}"); var store = new ConfigurationCollectionStore(optionsBuilder); store.CreateConfiguration <ExampleConfigurationCollection>("Test"); }
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_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 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 async Task ConfigurationStoreMultipleProfileIndividualAsync_Test() { var optionsBuilder = new DbContextOptionsBuilder <DatabaseContext>(); optionsBuilder.UseSqlite($"Data Source={Path.GetTempFileName()}"); var store = new ConfigurationCollectionStore(optionsBuilder); var configCollection = await store.CreateConfigurationAsync <ExampleConfigurationCollection>("Test"); configCollection.Configuration.ExampleConfiguration.ISOPath0 = "TestEqual"; configCollection.Configuration.ExampleConfiguration.FullscreenResolution = FullscreenResolution.Resolution1152X648; configCollection.Configuration.ExampleConfiguration.Fullscreen = false; var otherConfigCollection = store.CreateConfiguration <ExampleConfigurationCollection>("Test"); otherConfigCollection.Configuration.ExampleConfiguration.ISOPath0 = "TestNotEqual"; otherConfigCollection.Configuration.ExampleConfiguration.FullscreenResolution = FullscreenResolution.Resolution1280X1024; otherConfigCollection.Configuration.ExampleConfiguration.Fullscreen = true; await store.UpdateConfigurationAsync(configCollection); await store.UpdateConfigurationAsync(otherConfigCollection); var retrievedConfig = await store.GetConfigurationAsync <ExampleConfigurationCollection>(configCollection.ValueCollection.Guid); var newRetrievedConfig = await store.GetConfigurationAsync <ExampleConfigurationCollection>(otherConfigCollection.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); Assert.NotEqual(retrievedConfig.Configuration.ExampleConfiguration.FullscreenResolution, newRetrievedConfig.Configuration.ExampleConfiguration.FullscreenResolution); Assert.NotEqual(retrievedConfig.Configuration.ExampleConfiguration.ISOPath0, newRetrievedConfig.Configuration.ExampleConfiguration.ISOPath0); Assert.NotEqual(retrievedConfig.Configuration.ExampleConfiguration.Fullscreen, newRetrievedConfig.Configuration.ExampleConfiguration.Fullscreen); }
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); }
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); }