Add failing source filter query test

This commit is contained in:
Joseph Madamba 2024-11-15 22:51:36 -08:00
parent c2b08beae8
commit 7c94973d4a
No known key found for this signature in database
GPG Key ID: 8B746C7BDDF0BD76
1 changed files with 10 additions and 0 deletions

View File

@ -501,6 +501,16 @@ public void TestDifficultySearch(string query, int[] expectedBeatmapIndexes)
Assert.That(visibleBeatmaps, Is.EqualTo(expectedBeatmapIndexes)); Assert.That(visibleBeatmaps, Is.EqualTo(expectedBeatmapIndexes));
} }
[Test]
public void TestApplySourceQueries()
{
const string query = "find me songs with source=\"unit tests\" please";
var filterCriteria = new FilterCriteria();
FilterQueryParser.ApplyQueries(filterCriteria, query);
Assert.AreEqual("find me songs with please", filterCriteria.SearchText.Trim());
Assert.AreEqual(5, filterCriteria.SearchTerms.Length);
}
private class CustomFilterCriteria : IRulesetFilterCriteria private class CustomFilterCriteria : IRulesetFilterCriteria
{ {
public string? CustomValue { get; set; } public string? CustomValue { get; set; }