public void TestCriteriaMatchingNoRuleset() { var exampleBeatmapInfo = getExampleBeatmap(); var criteria = new FilterCriteria(); var carouselItem = new CarouselBeatmap(exampleBeatmapInfo); carouselItem.Filter(criteria); Assert.IsFalse(carouselItem.Filtered.Value); }
public void TestCriteriaMatchingSpecificRuleset() { var exampleBeatmapInfo = getExampleBeatmap(); var criteria = new FilterCriteria { Ruleset = new RulesetInfo { ShortName = "catch" } }; var carouselItem = new CarouselBeatmap(exampleBeatmapInfo); carouselItem.Filter(criteria); Assert.IsTrue(carouselItem.Filtered.Value); }
public void TestCustomRulesetCriteria([Values(null, true, false)] bool?matchCustomCriteria) { var beatmap = getExampleBeatmap(); var customCriteria = matchCustomCriteria is bool match ? new CustomCriteria(match) : null; var criteria = new FilterCriteria { RulesetCriteria = customCriteria }; var carouselItem = new CarouselBeatmap(beatmap); carouselItem.Filter(criteria); Assert.AreEqual(matchCustomCriteria == false, carouselItem.Filtered.Value); }
public void TestCriteriaMatchingArtist(string artistName, bool filtered) { var exampleBeatmapInfo = getExampleBeatmap(); var criteria = new FilterCriteria { Artist = new FilterCriteria.OptionalTextFilter { SearchTerm = artistName } }; var carouselItem = new CarouselBeatmap(exampleBeatmapInfo); carouselItem.Filter(criteria); Assert.AreEqual(filtered, carouselItem.Filtered.Value); }
public void TestCriteriaMatchingConvertedBeatmapsForCustomRulesets() { var exampleBeatmapInfo = getExampleBeatmap(); var criteria = new FilterCriteria { Ruleset = new RulesetInfo { OnlineID = -1 }, AllowConvertedBeatmaps = true }; var carouselItem = new CarouselBeatmap(exampleBeatmapInfo); carouselItem.Filter(criteria); Assert.IsFalse(carouselItem.Filtered.Value); }
public void TestCriteriaMatchingTerms(string terms, bool filtered) { var exampleBeatmapInfo = getExampleBeatmap(); var criteria = new FilterCriteria { Ruleset = new RulesetInfo { OnlineID = 6 }, AllowConvertedBeatmaps = true, SearchText = terms }; var carouselItem = new CarouselBeatmap(exampleBeatmapInfo); carouselItem.Filter(criteria); Assert.AreEqual(filtered, carouselItem.Filtered.Value); }
public void TestCriteriaMatchingBeatmapIDs(string query, bool filtered) { var beatmap = getExampleBeatmap(); beatmap.OnlineID = 20201010; beatmap.BeatmapSet = new BeatmapSetInfo { OnlineID = 1535 }; var criteria = new FilterCriteria { SearchText = query }; var carouselItem = new CarouselBeatmap(beatmap); carouselItem.Filter(criteria); Assert.AreEqual(filtered, carouselItem.Filtered.Value); }
public void TestCriteriaMatchingRangeMax(bool inclusive) { var exampleBeatmapInfo = getExampleBeatmap(); var criteria = new FilterCriteria { Ruleset = new RulesetInfo { OnlineID = 6 }, AllowConvertedBeatmaps = true, BPM = new FilterCriteria.OptionalRange <double> { IsUpperInclusive = inclusive, Max = 160d } }; var carouselItem = new CarouselBeatmap(exampleBeatmapInfo); carouselItem.Filter(criteria); Assert.AreEqual(!inclusive, carouselItem.Filtered.Value); }
public void TestCriteriaMatchingRangeMin(bool inclusive) { var exampleBeatmapInfo = getExampleBeatmap(); var criteria = new FilterCriteria { Ruleset = new RulesetInfo { OnlineID = 6 }, AllowConvertedBeatmaps = true, ApproachRate = new FilterCriteria.OptionalRange <float> { IsLowerInclusive = inclusive, Min = 5.0f } }; var carouselItem = new CarouselBeatmap(exampleBeatmapInfo); carouselItem.Filter(criteria); Assert.AreEqual(!inclusive, carouselItem.Filtered.Value); }