public void RaceConfigurationPresets_Test() { RaceConfigurationPresets cfgPresets = new RaceConfigurationPresets("."); var configs = cfgPresets.GetConfigurations(); Assert.AreEqual(2, configs.Count); Assert.IsTrue(configs.ContainsKey("DSV Erwachsene")); Assert.IsTrue(configs.ContainsKey("FIS Rennen Men")); // Create new Config var newConfig = new RaceConfiguration(configs["FIS Rennen Men"]); newConfig.Runs = 3; cfgPresets.SaveConfiguration("FIS Rennen - neu", newConfig); Assert.AreEqual(3, configs.Count); Assert.IsTrue(configs.ContainsKey("DSV Erwachsene")); Assert.IsTrue(configs.ContainsKey("FIS Rennen Men")); Assert.IsTrue(configs.ContainsKey("FIS Rennen - neu")); // Delete a config cfgPresets.DeleteConfiguration("FIS Rennen Men"); Assert.AreEqual(2, configs.Count); Assert.IsTrue(configs.ContainsKey("DSV Erwachsene")); Assert.IsTrue(configs.ContainsKey("FIS Rennen - neu")); Assert.AreEqual(3, cfgPresets.GetConfigurations()["FIS Rennen - neu"].Runs); // Create new Config with unsafe name var newConfig2 = new RaceConfiguration(configs["DSV Erwachsene"]); newConfig.Runs = 3; cfgPresets.SaveConfiguration(@"abc\*:;? 123", newConfig); Assert.AreEqual(3, configs.Count); Assert.IsTrue(configs.ContainsKey("DSV Erwachsene")); Assert.IsTrue(configs.ContainsKey(@"abc; 123")); Assert.IsTrue(configs.ContainsKey("FIS Rennen - neu")); }
public void Init(RaceConfiguration raceConfig) { // ApplicationFolder + raceconfigpresets _raceConfigurationPresets = new RaceConfigurationPresets(System.IO.Path.Combine(System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location), @"raceconfigpresets")); _raceConfiguration = raceConfig.Copy(); refreshConfigPresetsUI(); // Configuration Screen cmbRuns.Items.Clear(); cmbRuns.Items.Add(new CBItem { Text = "1", Value = 1 }); cmbRuns.Items.Add(new CBItem { Text = "2", Value = 2 }); cmbRuns.Items.Add(new CBItem { Text = "3", Value = 3 }); cmbRuns.Items.Add(new CBItem { Text = "4", Value = 4 }); cmbRuns.Items.Add(new CBItem { Text = "5", Value = 5 }); cmbRuns.Items.Add(new CBItem { Text = "6", Value = 6 }); // Result UiUtilities.FillGrouping(cmbConfigErgebnisGrouping); cmbConfigErgebnis.Items.Clear(); cmbConfigErgebnis.Items.Add(new CBItem { Text = "Bester Durchgang", Value = "RaceResult_BestOfTwo" }); cmbConfigErgebnis.Items.Add(new CBItem { Text = "Summe der besten 2 Durchgänge", Value = "RaceResult_SumBest2" }); cmbConfigErgebnis.Items.Add(new CBItem { Text = "Summe", Value = "RaceResult_Sum" }); cmbConfigErgebnis.Items.Add(new CBItem { Text = "Summe + Punkte nach DSV Schülerreglement", Value = "RaceResult_SumDSVPointsSchool" }); // Run 1 UiUtilities.FillGrouping(cmbConfigStartlist1Grouping); cmbConfigStartlist1.Items.Clear(); cmbConfigStartlist1.Items.Add(new CBItem { Text = "Startnummer (aufsteigend)", Value = "Startlist_1stRun_StartnumberAscending" }); cmbConfigStartlist1.Items.Add(new CBItem { Text = "Punkte (nicht gelost)", Value = "Startlist_1stRun_Points_0" }); cmbConfigStartlist1.Items.Add(new CBItem { Text = "Punkte (ersten 15 gelost)", Value = "Startlist_1stRun_Points_15" }); cmbConfigStartlist1.Items.Add(new CBItem { Text = "Punkte (ersten 30 gelost)", Value = "Startlist_1stRun_Points_30" }); // Run 2 UiUtilities.FillGrouping(cmbConfigStartlist2Grouping); cmbConfigStartlist2.Items.Clear(); cmbConfigStartlist2.Items.Add(new CBItem { Text = "Startnummer (aufsteigend)", Value = "Startlist_2nd_StartnumberAscending" }); //cmbConfigStartlist2.Items.Add(new GroupingCBItem { Text = "Startnummer (aufsteigend, inkl. ohne Ergebnis)", Value = "Startlist_2nd_StartnumberAscending" }); cmbConfigStartlist2.Items.Add(new CBItem { Text = "Startnummer (absteigend)", Value = "Startlist_2nd_StartnumberDescending" }); //cmbConfigStartlist2.Items.Add(new GroupingCBItem { Text = "Startnummer (absteigend, inkl. ohne Ergebnis)", Value = "Startlist_2nd_StartnumberDescending" }); cmbConfigStartlist2.Items.Add(new CBItem { Text = "Vorheriger Lauf nach Zeit (nicht gedreht)", Value = "Startlist_2nd_PreviousRun_0_OnlyWithResults" }); cmbConfigStartlist2.Items.Add(new CBItem { Text = "Vorheriger Lauf nach Zeit (nicht gedreht, inkl. ohne Ergebnis)", Value = "Startlist_2nd_PreviousRun_0_AlsoWithoutResults" }); cmbConfigStartlist2.Items.Add(new CBItem { Text = "Vorheriger Lauf nach Zeit (ersten 15 gedreht)", Value = "Startlist_2nd_PreviousRun_15_OnlyWithResults" }); cmbConfigStartlist2.Items.Add(new CBItem { Text = "Vorheriger Lauf nach Zeit (ersten 15 gedreht, inkl. ohne Ergebnis)", Value = "Startlist_2nd_PreviousRun_15_AlsoWithoutResults" }); cmbConfigStartlist2.Items.Add(new CBItem { Text = "Vorheriger Lauf nach Zeit (ersten 30 gedreht)", Value = "Startlist_2nd_PreviousRun_30_OnlyWithResults" }); cmbConfigStartlist2.Items.Add(new CBItem { Text = "Vorheriger Lauf nach Zeit (ersten 30 gedreht, inkl. ohne Ergebnis)", Value = "Startlist_2nd_PreviousRun_30_AlsoWithoutResults" }); cmbConfigStartlist2.Items.Add(new CBItem { Text = "Vorheriger Lauf nach Zeit (alle gedreht)", Value = "Startlist_2nd_PreviousRun_all_OnlyWithResults" }); cmbConfigStartlist2.Items.Add(new CBItem { Text = "Vorheriger Lauf nach Zeit (alle gedreht, inkl. ohne Ergebnis)", Value = "Startlist_2nd_PreviousRun_all_AlsoWithoutResults" }); ResetConfigurationSelectionUI(_raceConfiguration); }
public void GlobalRaceConfig_DSVAlpinExport() { RaceConfigurationPresets cfgPresets = new RaceConfigurationPresets("raceconfigpresets"); string dbFilename = TestUtilities.CreateWorkingFileFrom(testContextInstance.TestDeploymentDir, @"TestDB_Empty.mdb"); Database db = new Database(); db.Connect(dbFilename); AppDataModel model = new AppDataModel(db); RaceConfiguration config; config = cfgPresets.GetConfiguration("DSV Erwachsene"); Assert.AreEqual(CompetitionProperties.ECompetitionType.DSV_Points, config.InternalDSVAlpinCompetitionTypeWrite); model.GlobalRaceConfig = config; Assert.AreEqual(CompetitionProperties.ECompetitionType.DSV_Points, db.GetCompetitionProperties().Type); config = cfgPresets.GetConfiguration("DSV Schüler U14-U16"); Assert.AreEqual(CompetitionProperties.ECompetitionType.DSV_SchoolPoints, config.InternalDSVAlpinCompetitionTypeWrite); model.GlobalRaceConfig = config; Assert.AreEqual(CompetitionProperties.ECompetitionType.DSV_SchoolPoints, db.GetCompetitionProperties().Type); config = cfgPresets.GetConfiguration("FIS Rennen Men"); Assert.AreEqual(CompetitionProperties.ECompetitionType.FIS_Men, config.InternalDSVAlpinCompetitionTypeWrite); model.GlobalRaceConfig = config; Assert.AreEqual(CompetitionProperties.ECompetitionType.FIS_Men, db.GetCompetitionProperties().Type); config = cfgPresets.GetConfiguration("FIS Rennen Women"); Assert.AreEqual(CompetitionProperties.ECompetitionType.FIS_Women, config.InternalDSVAlpinCompetitionTypeWrite); model.GlobalRaceConfig = config; Assert.AreEqual(CompetitionProperties.ECompetitionType.FIS_Women, db.GetCompetitionProperties().Type); config = cfgPresets.GetConfiguration("Inline (allgemein)"); Assert.AreEqual(CompetitionProperties.ECompetitionType.ClubInternal_Sum, config.InternalDSVAlpinCompetitionTypeWrite); model.GlobalRaceConfig = config; Assert.AreEqual(CompetitionProperties.ECompetitionType.ClubInternal_Sum, db.GetCompetitionProperties().Type); config = cfgPresets.GetConfiguration("Inline (Punkte)"); Assert.AreEqual(CompetitionProperties.ECompetitionType.DSV_Points, config.InternalDSVAlpinCompetitionTypeWrite); model.GlobalRaceConfig = config; Assert.AreEqual(CompetitionProperties.ECompetitionType.DSV_Points, db.GetCompetitionProperties().Type); config = cfgPresets.GetConfiguration("KSC Ebersberg -U12"); Assert.AreEqual(CompetitionProperties.ECompetitionType.ClubInternal_BestRun, config.InternalDSVAlpinCompetitionTypeWrite); model.GlobalRaceConfig = config; Assert.AreEqual(CompetitionProperties.ECompetitionType.ClubInternal_BestRun, db.GetCompetitionProperties().Type); config = cfgPresets.GetConfiguration("KSC Ebersberg U14-"); Assert.AreEqual(CompetitionProperties.ECompetitionType.ClubInternal_Sum, config.InternalDSVAlpinCompetitionTypeWrite); model.GlobalRaceConfig = config; Assert.AreEqual(CompetitionProperties.ECompetitionType.ClubInternal_Sum, db.GetCompetitionProperties().Type); config = cfgPresets.GetConfiguration("SVM Schüler U12"); Assert.AreEqual(CompetitionProperties.ECompetitionType.ClubInternal_Sum, config.InternalDSVAlpinCompetitionTypeWrite); model.GlobalRaceConfig = config; Assert.AreEqual(CompetitionProperties.ECompetitionType.ClubInternal_Sum, db.GetCompetitionProperties().Type); config = cfgPresets.GetConfiguration("SVM Schüler U8-U10"); Assert.AreEqual(CompetitionProperties.ECompetitionType.ClubInternal_BestRun, config.InternalDSVAlpinCompetitionTypeWrite); model.GlobalRaceConfig = config; Assert.AreEqual(CompetitionProperties.ECompetitionType.ClubInternal_BestRun, db.GetCompetitionProperties().Type); config = cfgPresets.GetConfiguration("Vereinsrennen - BestOfTwo"); Assert.AreEqual(CompetitionProperties.ECompetitionType.ClubInternal_BestRun, config.InternalDSVAlpinCompetitionTypeWrite); model.GlobalRaceConfig = config; Assert.AreEqual(CompetitionProperties.ECompetitionType.ClubInternal_BestRun, db.GetCompetitionProperties().Type); config = cfgPresets.GetConfiguration("Vereinsrennen - Summe"); Assert.AreEqual(CompetitionProperties.ECompetitionType.ClubInternal_Sum, config.InternalDSVAlpinCompetitionTypeWrite); model.GlobalRaceConfig = config; Assert.AreEqual(CompetitionProperties.ECompetitionType.ClubInternal_Sum, db.GetCompetitionProperties().Type); config = cfgPresets.GetConfiguration("Vereinsrennen - Summe"); Assert.AreEqual(CompetitionProperties.ECompetitionType.ClubInternal_Sum, config.InternalDSVAlpinCompetitionTypeWrite); config.ActiveFields = new List <string>(); model.GlobalRaceConfig = config; Assert.IsFalse(db.GetCompetitionProperties().WithPoints); Assert.IsFalse(db.GetCompetitionProperties().FieldActiveClub); Assert.IsFalse(db.GetCompetitionProperties().FieldActiveCode); Assert.IsFalse(db.GetCompetitionProperties().FieldActiveYear); Assert.IsFalse(db.GetCompetitionProperties().FieldActiveNation); config.ActiveFields = new List <string> { "Points" }; model.GlobalRaceConfig = config; Assert.IsTrue(db.GetCompetitionProperties().WithPoints); Assert.IsFalse(db.GetCompetitionProperties().FieldActiveClub); Assert.IsFalse(db.GetCompetitionProperties().FieldActiveCode); Assert.IsFalse(db.GetCompetitionProperties().FieldActiveYear); Assert.IsFalse(db.GetCompetitionProperties().FieldActiveNation); config.ActiveFields = new List <string> { "Club" }; model.GlobalRaceConfig = config; Assert.IsFalse(db.GetCompetitionProperties().WithPoints); Assert.IsTrue(db.GetCompetitionProperties().FieldActiveClub); Assert.IsFalse(db.GetCompetitionProperties().FieldActiveCode); Assert.IsFalse(db.GetCompetitionProperties().FieldActiveYear); Assert.IsFalse(db.GetCompetitionProperties().FieldActiveNation); config.ActiveFields = new List <string> { "Code" }; model.GlobalRaceConfig = config; Assert.IsFalse(db.GetCompetitionProperties().WithPoints); Assert.IsFalse(db.GetCompetitionProperties().FieldActiveClub); Assert.IsTrue(db.GetCompetitionProperties().FieldActiveCode); Assert.IsFalse(db.GetCompetitionProperties().FieldActiveYear); Assert.IsFalse(db.GetCompetitionProperties().FieldActiveNation); config.ActiveFields = new List <string> { "Year" }; model.GlobalRaceConfig = config; Assert.IsFalse(db.GetCompetitionProperties().WithPoints); Assert.IsFalse(db.GetCompetitionProperties().FieldActiveClub); Assert.IsFalse(db.GetCompetitionProperties().FieldActiveCode); Assert.IsTrue(db.GetCompetitionProperties().FieldActiveYear); Assert.IsFalse(db.GetCompetitionProperties().FieldActiveNation); config.ActiveFields = new List <string> { "Nation" }; model.GlobalRaceConfig = config; Assert.IsFalse(db.GetCompetitionProperties().WithPoints); Assert.IsFalse(db.GetCompetitionProperties().FieldActiveClub); Assert.IsFalse(db.GetCompetitionProperties().FieldActiveCode); Assert.IsFalse(db.GetCompetitionProperties().FieldActiveYear); Assert.IsTrue(db.GetCompetitionProperties().FieldActiveNation); config.ActiveFields = new List <string> { "Year", "Nation", "Code", "Points", "Club" }; model.GlobalRaceConfig = config; Assert.IsTrue(db.GetCompetitionProperties().WithPoints); Assert.IsTrue(db.GetCompetitionProperties().FieldActiveClub); Assert.IsTrue(db.GetCompetitionProperties().FieldActiveCode); Assert.IsTrue(db.GetCompetitionProperties().FieldActiveYear); Assert.IsTrue(db.GetCompetitionProperties().FieldActiveNation); }