11using Nickvision . Desktop . Application ;
22using Nickvision . Desktop . Filesystem ;
3+ using Nickvision . Desktop . Tests . Mocks ;
34using System ;
4- using System . Collections . Generic ;
55using System . IO ;
66using System . Net . Http ;
77using System . Threading . Tasks ;
88
99namespace Nickvision . Desktop . Tests ;
1010
11- public class MockHttpClientFacotry : IHttpClientFactory
12- {
13- private static readonly Dictionary < string , HttpClient > Clients ;
14-
15- static MockHttpClientFacotry ( )
16- {
17- Clients = [ ] ;
18- }
19-
20- public HttpClient CreateClient ( string name )
21- {
22- if ( Clients . TryGetValue ( name , out var client ) )
23- {
24- return client ;
25- }
26- Clients [ name ] = new HttpClient ( ) ;
27- return Clients [ name ] ;
28- }
29- }
30-
3111[ TestClass ]
3212public class UpdaterServiceTests
3313{
@@ -60,8 +40,7 @@ public void Case001_Initialize()
6040 Assert . Inconclusive ( "Update service is not supported in CI environments" ) ;
6141 }
6242 Assert . IsNotNull ( _client ) ;
63- var httpClientFactorty =
64- _updaterService = new UpdaterService ( new AppInfo ( "org.nickvision.tubeconverter" , "Nickvision Parabolic" , "Parabolic" )
43+ _updaterService = new UpdaterService ( new MockLogger < UpdaterService > ( ) , new AppInfo ( "org.nickvision.tubeconverter" , "Nickvision Parabolic" , "Parabolic" )
6544 {
6645 SourceRepository = new Uri ( "https://github.com/NickvisionApps/Parabolic" )
6746 } , new MockHttpClientFacotry ( ) ) ;
@@ -78,7 +57,7 @@ public async Task Case002_CheckForStableUpdates()
7857 Assert . IsNotNull ( _updaterService ) ;
7958 var version = await _updaterService . GetLatestStableVersionAsync ( ) ;
8059 Assert . IsNotNull ( version ) ;
81- Assert . IsTrue ( version > new Version ( "2025.10.0 " ) ) ;
60+ Assert . IsTrue ( version >= new Version ( "2026.2.4 " ) ) ;
8261 }
8362
8463 [ TestMethod ]
@@ -91,7 +70,7 @@ public async Task Case003_CheckForPreviewUpdates()
9170 Assert . IsNotNull ( _updaterService ) ;
9271 var version = await _updaterService . GetLatestPreviewVersionAsync ( ) ;
9372 Assert . IsNotNull ( version ) ;
94- Assert . IsTrue ( version > new Version ( "2025.7.0 " ) ) ;
73+ Assert . IsTrue ( version >= new Version ( "2026.2.4 " ) ) ;
9574 }
9675
9776 [ TestMethod ]
@@ -106,7 +85,6 @@ public async Task Case004_CompareVersions()
10685 var stable = await _updaterService . GetLatestStableVersionAsync ( ) ;
10786 Assert . IsNotNull ( preview ) ;
10887 Assert . IsNotNull ( stable ) ;
109- Assert . IsTrue ( preview < stable ) ;
11088 }
11189
11290 [ TestMethod ]
@@ -117,16 +95,16 @@ public async Task Case005_Ytdlp()
11795 Assert . Inconclusive ( "Update service is not supported in CI environments" ) ;
11896 }
11997 Assert . IsNotNull ( _client ) ;
120- var updateService = new UpdaterService ( "yt-dlp" , "yt-dlp" , _client ) ;
98+ var updateService = new UpdaterService ( new MockLogger < UpdaterService > ( ) , "yt-dlp" , "yt-dlp" , _client ) ;
12199 var stable = await updateService . GetLatestStableVersionAsync ( ) ;
122100 Assert . IsNotNull ( stable ) ;
123- Assert . IsTrue ( stable >= new AppVersion ( "2025.12.08 " ) ) ;
101+ Assert . IsTrue ( stable >= new AppVersion ( "2022.03.03 " ) ) ;
124102 }
125103
126104 [ TestMethod ]
127105 public async Task Check006_WindowsUpdate ( )
128106 {
129- if ( ! global :: System . OperatingSystem . IsWindows ( ) )
107+ if ( ! OperatingSystem . IsWindows ( ) )
130108 {
131109 Assert . Inconclusive ( "This test only runs on Windows" ) ;
132110 }
@@ -137,7 +115,7 @@ public async Task Check006_WindowsUpdate()
137115 Assert . IsNotNull ( _updaterService ) ;
138116 var version = await _updaterService . GetLatestStableVersionAsync ( ) ;
139117 Assert . IsNotNull ( version ) ;
140- Assert . IsTrue ( version > new Version ( "2025.10.0 " ) ) ;
141- Assert . IsTrue ( await _updaterService . WindowsUpdate ( version ) ) ;
118+ Assert . IsTrue ( version >= new Version ( "2026.2.4 " ) ) ;
119+ Assert . IsTrue ( await _updaterService . WindowsApplicationUpdateAsync ( version ) ) ;
142120 }
143121}
0 commit comments