From 9a979942e3af75214b2243ae71adac9c574c67f5 Mon Sep 17 00:00:00 2001 From: real-zony Date: Fri, 29 Nov 2024 23:12:26 +0800 Subject: [PATCH] test: Removed irrelevant tests. --- .../Infrastructure/Lyrics/KuGouLyricProviderTests.cs | 2 +- .../Lyrics/NetEaseLyricsProviderTests.cs | 7 ------- .../Infrastructure/Network/WarpClientTests.cs | 9 +++++---- tests/ZonyLrcTools.Tests/MusicInfoTests.cs | 10 +++++++--- 4 files changed, 13 insertions(+), 15 deletions(-) diff --git a/tests/ZonyLrcTools.Tests/Infrastructure/Lyrics/KuGouLyricProviderTests.cs b/tests/ZonyLrcTools.Tests/Infrastructure/Lyrics/KuGouLyricProviderTests.cs index fd191ff..dae7c63 100644 --- a/tests/ZonyLrcTools.Tests/Infrastructure/Lyrics/KuGouLyricProviderTests.cs +++ b/tests/ZonyLrcTools.Tests/Infrastructure/Lyrics/KuGouLyricProviderTests.cs @@ -33,7 +33,7 @@ namespace ZonyLrcTools.Tests.Infrastructure.Lyrics await Should.ThrowAsync(_lyricsProvider.DownloadAsync("天ノ弱", "漆柚").AsTask); } - [Fact] + [Fact(Skip = "This music already exists KuGou's database.")] public async Task DownloadAsync_Index_Exception_Test() { await Should.ThrowAsync(async () => await _lyricsProvider.DownloadAsync("40'z", "ZOOLY")); diff --git a/tests/ZonyLrcTools.Tests/Infrastructure/Lyrics/NetEaseLyricsProviderTests.cs b/tests/ZonyLrcTools.Tests/Infrastructure/Lyrics/NetEaseLyricsProviderTests.cs index 8a2261a..a287aec 100644 --- a/tests/ZonyLrcTools.Tests/Infrastructure/Lyrics/NetEaseLyricsProviderTests.cs +++ b/tests/ZonyLrcTools.Tests/Infrastructure/Lyrics/NetEaseLyricsProviderTests.cs @@ -113,13 +113,6 @@ namespace ZonyLrcTools.Tests.Infrastructure.Lyrics lyric.IsPruneMusic.ShouldBeTrue(); } - [Fact] - public async Task DownloadAsync_NullException_Test() - { - var result = await Should.ThrowAsync(_lyricsProvider.DownloadAsync("創世記", "りりィ").AsTask); - result.ErrorCode.ShouldBe(ErrorCodes.NoMatchingSong); - } - [Fact] public async Task DownloadAsync_Source_Null_Test() { diff --git a/tests/ZonyLrcTools.Tests/Infrastructure/Network/WarpClientTests.cs b/tests/ZonyLrcTools.Tests/Infrastructure/Network/WarpClientTests.cs index a1b5d7a..502a3d4 100644 --- a/tests/ZonyLrcTools.Tests/Infrastructure/Network/WarpClientTests.cs +++ b/tests/ZonyLrcTools.Tests/Infrastructure/Network/WarpClientTests.cs @@ -5,6 +5,7 @@ using Shouldly; using Xunit; using ZonyLrcTools.Common.Configuration; using ZonyLrcTools.Common.Infrastructure.Network; +using ZonyLrcTools.Common.Updater; namespace ZonyLrcTools.Tests.Infrastructure.Network { @@ -25,9 +26,9 @@ namespace ZonyLrcTools.Tests.Infrastructure.Network { var client = ServiceProvider.GetRequiredService(); - var response = await client.GetAsync(@"https://www.baidu.com"); + var response = await client.GetAsync(DefaultUpdater.UpdateUrl); response.ShouldNotBeNull(); - response.ShouldContain("百度"); + response.ShouldContain("NewVersion"); } [Fact] @@ -39,10 +40,10 @@ namespace ZonyLrcTools.Tests.Infrastructure.Network var client = ServiceProvider.GetRequiredService(); - var response = await client.GetAsync(@"https://www.baidu.com"); + var response = await client.GetAsync(DefaultUpdater.UpdateUrl); response.ShouldNotBeNull(); - response.ShouldContain("百度"); + response.ShouldContain("NewVersion"); } } } \ No newline at end of file diff --git a/tests/ZonyLrcTools.Tests/MusicInfoTests.cs b/tests/ZonyLrcTools.Tests/MusicInfoTests.cs index 282c151..ec507cd 100644 --- a/tests/ZonyLrcTools.Tests/MusicInfoTests.cs +++ b/tests/ZonyLrcTools.Tests/MusicInfoTests.cs @@ -1,4 +1,5 @@ -using Shouldly; +using System.IO; +using Shouldly; using Xunit; using ZonyLrcTools.Common; @@ -9,7 +10,10 @@ public class MusicInfoTests [Fact] public void InvalidFilePathTest() { - var musicInfo = new MusicInfo("C:\\Users\\Zony\\Music\\[ZonyLrcTools]:? - 01. 你好.mp3", "你好", "Zony"); - musicInfo.FilePath.ShouldBe(@"C:\Users\Zony\Music\[ZonyLrcTools] - 01. 你好.mp3"); + var tempFilePath = Path.GetTempFileName(); + var errorFilePath = $"{tempFilePath}" + "?:"; + + var musicInfo = new MusicInfo(errorFilePath, "你好", "Zony"); + musicInfo.FilePath.ShouldBe(tempFilePath); } } \ No newline at end of file