public void Group_OneSubstituteEmpty() { TestLevelCompletionResults results = TestLevelCompletionResults.DefaultCompletionResults; TestGameplayModifiers modifiers = new TestGameplayModifiers(); TestDifficultyBeatmap b = TestDifficultyBeatmap.Default; results.GameplayModifiers = modifiers; b.SongName = "<TestSongName>"; modifiers.DisappearingArrows = true; modifiers.FastNotes = true; modifiers.SongSpeed = SongSpeed.Slower; results.LevelEndStateType = LevelEndState.Failed; results.MaxCombo = results.TotalNotes - 1; string baseString = "?N<_?F>"; string expectedModifierString = modifiers.ToString(); string expectedResult = OBSControl.Utilities.Utilities.GetSafeFilename($"{b.SongName}"); Console.WriteLine("Format: " + baseString); string result = GetFilenameString(baseString, b, results); Assert.AreEqual(expectedResult, result); Console.WriteLine(" " + result + ".mkv"); baseString = "?N-?A_[?M]<-?F>-?e"; Console.WriteLine("Format: " + baseString); result = GetFilenameString(baseString, b, results); expectedResult = OBSControl.Utilities.Utilities.GetSafeFilename($"{b.SongName}-{b.LevelAuthorName}_[{expectedModifierString}]-Failed"); Assert.AreEqual(expectedResult, result); Console.WriteLine(" " + result + ".mkv"); }
public void NoArguments() { TestLevelCompletionResults results = TestLevelCompletionResults.DefaultCompletionResults; TestDifficultyBeatmap difficultyBeatmap = TestDifficultyBeatmap.Default; string baseString = "NoArguments"; Console.WriteLine("Format: " + baseString); string result = GetFilenameString(baseString, difficultyBeatmap, results); Assert.AreEqual(baseString, result); }
public void CustomSpaceSubstitute() { TestDifficultyBeatmap difficultyBeatmap = TestDifficultyBeatmap.Default; TestLevelCompletionResults results = TestLevelCompletionResults.DefaultCompletionResults; difficultyBeatmap.SongName = "Test Song"; string baseString = $"?N-?A"; string result = GetFilenameString(baseString, difficultyBeatmap, results, string.Empty, "."); string expectedResult = $"{difficultyBeatmap.SongName.Replace(' ', '.')}-{difficultyBeatmap.LevelAuthorName}"; Assert.AreEqual(expectedResult, result); Console.WriteLine(result.Replace("__", "\n")); }
public void DateAtEnd_Test() { TestLevelCompletionResults results = TestLevelCompletionResults.DefaultCompletionResults; TestGameplayModifiers modifiers = new TestGameplayModifiers(); TestDifficultyBeatmap b = TestDifficultyBeatmap.Default; results.GameplayModifiers = modifiers; string dateFormat = "yyyyMMdd"; string baseString = $"?N-?A_?@{{{dateFormat}}}"; Console.WriteLine("Format: " + baseString); string expectedResult = OBSControl.Utilities.Utilities.GetSafeFilename($"{b.SongName}-{b.LevelAuthorName}_{DateTime.Now.ToString(dateFormat)}"); string result = GetFilenameString(baseString, b, results); Console.WriteLine($"Result: '{result}'"); Assert.AreEqual(expectedResult, result); }
public void CustomInvalidCharacterSubstitute() { TestDifficultyBeatmap difficultyBeatmap = TestDifficultyBeatmap.Default; TestLevelCompletionResults results = TestLevelCompletionResults.DefaultCompletionResults; char[] invalidChars = Path.GetInvalidFileNameChars(); Console.WriteLine($"InvalidFileNameChars: {string.Join(' ', Path.GetInvalidFileNameChars())}"); for (int i = 0; i < invalidChars.Length; i++) { difficultyBeatmap.SongName = $"Test{invalidChars[i]}Son g"; string baseString = $"?N-?A"; string result = GetFilenameString(baseString, difficultyBeatmap, results, ".", "."); string expectedResult = $"Test.Son.g-{difficultyBeatmap.LevelAuthorName}"; Assert.AreEqual(expectedResult, result); Console.WriteLine(result.Replace("__", "\n")); } }
public void SongAndAuthorLimits() { TestLevelCompletionResults results = TestLevelCompletionResults.DefaultCompletionResults; TestGameplayModifiers modifiers = new TestGameplayModifiers(); TestDifficultyBeatmap b = TestDifficultyBeatmap.Default; results.GameplayModifiers = modifiers; string dateFormat = "yyyyMMdd"; int authorLimit = 5; int songLimit = 3; string baseString = $"?N{{{songLimit}}}-?A{{{authorLimit}}}_?@{{{dateFormat}}}-?D"; Console.WriteLine("Format: " + baseString); string expectedResult = $"{b.SongName.Substring(0, songLimit)}-{b.LevelAuthorName.Substring(0, authorLimit)}_{DateTime.Now.ToString(dateFormat)}-{b.Difficulty}"; expectedResult = OBSControl.Utilities.Utilities.GetSafeFilename(expectedResult); string result = GetFilenameString(baseString, b, results); Console.WriteLine($"Result: '{result}'"); Assert.AreEqual(expectedResult, result); }