public void KnownSystemHasValidCategory(KnownSystemComboBoxItem system) { KnownSystem[] markers = { KnownSystem.MarkerArcadeEnd, KnownSystem.MarkerDiscBasedConsoleEnd, /* KnownSystem.MarkerOtherConsoleEnd, */ KnownSystem.MarkerComputerEnd, KnownSystem.MarkerOtherEnd }; // Non-system items won't map if (system.IsHeader) { return; } // NONE will never map if (system == KnownSystem.NONE) { return; } // we check that the category is the first category value higher than the system KnownSystemCategory category = ((KnownSystem?)system).Category(); KnownSystem marker = KnownSystem.NONE; switch (category) { case KnownSystemCategory.Arcade: marker = KnownSystem.MarkerArcadeEnd; break; case KnownSystemCategory.DiscBasedConsole: marker = KnownSystem.MarkerDiscBasedConsoleEnd; break; /* case KnownSystemCategory.OtherConsole: marker = KnownSystem.MarkerOtherConsoleEnd; break; */ case KnownSystemCategory.Computer: marker = KnownSystem.MarkerComputerEnd; break; case KnownSystemCategory.Other: marker = KnownSystem.MarkerOtherEnd; break; } Assert.NotEqual(KnownSystem.NONE, marker); Assert.True(marker > system); Array.ForEach(markers, mmarker => { // a marker can be the same of the found one, or one of a category before or a category after but never in the middle between // the system and the mapped category Assert.True(mmarker == marker || mmarker <system || mmarker> marker); }); }
public void KnownSystemHasValidCategory() { var values = Validators.CreateListOfSystems(); KnownSystem[] markers = { KnownSystem.MarkerArcadeEnd, KnownSystem.MarkerConsoleEnd, KnownSystem.MarkerComputerEnd, KnownSystem.MarkerOtherEnd }; values.ForEach(system => { if (system == KnownSystem.NONE || system == KnownSystem.Custom) { return; } // we check that the category is the first category value higher than the system KnownSystemCategory category = ((KnownSystem?)system).Category(); KnownSystem marker = KnownSystem.NONE; switch (category) { case KnownSystemCategory.Arcade: marker = KnownSystem.MarkerArcadeEnd; break; case KnownSystemCategory.Console: marker = KnownSystem.MarkerConsoleEnd; break; case KnownSystemCategory.Computer: marker = KnownSystem.MarkerComputerEnd; break; case KnownSystemCategory.Other: marker = KnownSystem.MarkerOtherEnd; break; } Assert.NotEqual(KnownSystem.NONE, marker); Assert.True(marker > system); Array.ForEach(markers, mmarker => { // a marker can be the same of the found one, or one of a category before or a category after but never in the middle between // the system and the mapped category Assert.True(mmarker == marker || mmarker <system || mmarker> marker); }); }); }