public void TestOpen() { string filename = Path.GetTempFileName(); File.Delete(filename); using (IDataSource dataSource = new GlobalOptionsDataSource()) { dataSource.New(filename); dataSource.IsOpen().Should().BeTrue(); dataSource.Close(); dataSource.IsOpen().Should().BeFalse(); dataSource.Open(filename); dataSource.IsOpen().Should().BeTrue(); dataSource.Close(); } File.Delete(filename); }
public void TestTablesExist() { string filename = Path.GetTempFileName(); File.Delete(filename); using (GlobalOptionsDataSource dataSource = new GlobalOptionsDataSource()) { dataSource.New(filename); dataSource.IsOpen().Should().BeTrue(); dataSource.GetDataConnection().DbConnection.TableExists(CoreSchemaTableName.SETTING_V1).Should().BeTrue(); dataSource.GetDataConnection().DbConnection.TableExists(CoreSchemaTableName.USAGE_V1).Should().BeTrue(); dataSource.GetDataConnection().DbConnection.TableExists(CoreSchemaTableName.INFOTABLE_V1).Should().BeFalse(); } }
public void TestSetAndGetValues() { string filename = Path.GetTempFileName(); File.Delete(filename); using (GlobalOptionsDataSource dataSource = new GlobalOptionsDataSource()) { dataSource.New(filename); dataSource.IsOpen().Should().BeTrue(); dataSource.SetGlobalSetting(SettingName.EXPAND_CATEGS_TREE, true); dataSource.SetGlobalSetting(SettingName.SHOWBEGINAPP, true); dataSource.SetGlobalSetting(SettingName.SHOW_HIDDEN_CATEGS, false); dataSource.SetGlobalSetting(SettingName.LASTFILENAME, filename); dataSource.SetGlobalSetting(SettingName.RECENT_DB_1, filename); dataSource.SetGlobalSetting(SettingName.SIZEW, 600); dataSource.SetGlobalSetting(SettingName.SIZEH, 800); dataSource.SetGlobalSetting(SettingName.VIEWACCOUNTS, "ALL"); dataSource.GetGlobalSetting(SettingName.EXPAND_CATEGS_TREE, false).Should().BeTrue(); dataSource.GetGlobalSetting(SettingName.SHOWBEGINAPP, true).Should().BeTrue(); dataSource.GetGlobalSetting(SettingName.SHOW_HIDDEN_CATEGS, false).Should().BeFalse(); dataSource.GetGlobalSetting <string>(SettingName.LASTFILENAME, string.Empty).Should().Be(filename); dataSource.GetGlobalSetting <string>(SettingName.RECENT_DB_1, string.Empty).Should().Be(filename); dataSource.GetGlobalSetting(SettingName.SIZEW, 100).Should().Be(600); dataSource.GetGlobalSetting(SettingName.SIZEH, 100).Should().Be(800); dataSource.GetGlobalSetting <string>(SettingName.VIEWACCOUNTS, "ALL").Should().Be("ALL"); } File.Delete(filename); }