示例#1
0
        public void TestCriteriaMatchingNoRuleset()
        {
            var exampleBeatmapInfo = getExampleBeatmap();
            var criteria           = new FilterCriteria();
            var carouselItem       = new CarouselBeatmap(exampleBeatmapInfo);

            carouselItem.Filter(criteria);
            Assert.IsFalse(carouselItem.Filtered.Value);
        }
示例#2
0
        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);
        }
示例#3
0
        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);
        }
示例#4
0
        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);
        }
示例#5
0
        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);
        }
示例#6
0
        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);
        }
示例#7
0
        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);
        }
示例#8
0
        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);
        }
示例#9
0
        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);
        }