Skip to content

Commit 1c1e83b

Browse files
Merge pull request #123 from ChristianGalla/mstest-3.7.0
Update unit test framework
2 parents 48672f6 + ce19d47 commit 1c1e83b

29 files changed

+2912
-110
lines changed

AutoStartConfirm.sln

Lines changed: 154 additions & 6 deletions
Large diffs are not rendered by default.

AutoStartConfirm/packages.lock.json

Lines changed: 47 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -52,27 +52,29 @@
5252
},
5353
"H.GeneratedIcons.System.Drawing": {
5454
"type": "Transitive",
55-
"resolved": "2.0.131",
56-
"contentHash": "QoNGQrhxzG+dQufa4xRjSqihMy5aVVVZqQUt0fLJbwhs7rcM4hpN1qVkZpZEkHsRgrHfFBC/Ursjh8STY/sg7A==",
55+
"resolved": "2.2.0",
56+
"contentHash": "KJ/hQZTtW3w8Rw8ktogAwY9AcVzpUldVprTD3eyQ1XyZINLHBQqgtu0ZArmuYlp+lUR0lsqAmaARXZIOFBWmQg==",
5757
"dependencies": {
58-
"System.Drawing.Common": "8.0.0"
58+
"System.Drawing.Common": "9.0.0"
5959
}
6060
},
6161
"H.NotifyIcon": {
6262
"type": "Transitive",
63-
"resolved": "2.0.131",
64-
"contentHash": "mdznQAfcJFehblFoDUvtmdm1Y9+u1eMN1ffORbdYv5EwreMxkCwvdj8qQn3qnUo9EIJ6h5Xdgqey9Nj4us8w7w==",
63+
"resolved": "2.2.0",
64+
"contentHash": "x3rk9dLAXpMrfngnC7oHmYF4sULEpEdD9hLMIt0W41MZ8WYeCY63SeyJX1TKcvJ7BI24JciLxhXOuWrSRCEiQA==",
6565
"dependencies": {
66-
"H.GeneratedIcons.System.Drawing": "2.0.131"
66+
"H.GeneratedIcons.System.Drawing": "2.2.0"
6767
}
6868
},
6969
"H.NotifyIcon.WinUI": {
7070
"type": "Transitive",
71-
"resolved": "2.0.131",
72-
"contentHash": "W+C+Nl1XhsGMbPjW0GyK311qJa8uTeqXZJ7WziPjgqTPDis8tIhWKh+/nB9Jz0XPBSQntQzmIkrSiUwmohee9g==",
71+
"resolved": "2.2.0",
72+
"contentHash": "iWaNX3qbcOWisPygW091RFzY1tl//Nm2HCIzBxFDoz+cpRhdInuV/xelqQ8WQTM0z5PamA9+FgGlSYygzu18Gw==",
7373
"dependencies": {
74-
"H.NotifyIcon": "2.0.131",
75-
"Microsoft.WindowsAppSDK": "1.4.231115000"
74+
"H.NotifyIcon": "2.2.0",
75+
"Microsoft.WindowsAppSDK": "1.6.241114003",
76+
"System.Collections.Immutable": "9.0.0",
77+
"System.Reflection.Metadata": "9.0.0"
7678
}
7779
},
7880
"Microsoft.CSharp": {
@@ -170,8 +172,8 @@
170172
},
171173
"Microsoft.Win32.SystemEvents": {
172174
"type": "Transitive",
173-
"resolved": "8.0.0",
174-
"contentHash": "9opKRyOKMCi2xJ7Bj7kxtZ1r9vbzosMvRrdEhVhDz8j8MoBGgB+WmC94yH839NPH+BclAjtQ/pyagvi/8gDLkw=="
175+
"resolved": "9.0.0",
176+
"contentHash": "z8FfGIaoeALdD+KF44A2uP8PZIQQtDGiXsOLuN8nohbKhkyKt7zGaZb+fKiCxTuBqG22Q7myIAioSWaIcOOrOw=="
175177
},
176178
"Microsoft.Windows.SDK.BuildTools": {
177179
"type": "Transitive",
@@ -217,8 +219,8 @@
217219
},
218220
"Octokit": {
219221
"type": "Transitive",
220-
"resolved": "13.0.1",
221-
"contentHash": "tjXTa2FXzbd3n17VWpi8UXe05EIJqHcWJW8C2kukftIve00duWiZL8x4i1vlZQ0zQ4RbRANbRc7J5K7Co/1spQ=="
222+
"resolved": "14.0.0",
223+
"contentHash": "jGOuTH1l+TCpJH+fwYOp7USzHDuGfN1jKbLz3J2COwyn+wL08eynvpnM6rY2qkzIEXum3PN2p2QkP3BW/p9Qcw=="
222224
},
223225
"Semver": {
224226
"type": "Transitive",
@@ -233,26 +235,31 @@
233235
"resolved": "9.0.0",
234236
"contentHash": "oTE5IfuMoET8yaZP/vdvy9xO47guAv/rOhe4DODuFBN3ySprcQOlXqO3j+e/H/YpKKR5sglrxRaZ2HYOhNJrqA=="
235237
},
236-
"System.Configuration.ConfigurationManager": {
238+
"System.Collections.Immutable": {
237239
"type": "Transitive",
238240
"resolved": "9.0.0",
239-
"contentHash": "PdkuMrwDhXoKFo/JxISIi9E8L+QGn9Iquj2OKDWHB6Y/HnUOuBouF7uS3R4Hw3FoNmwwMo6hWgazQdyHIIs27A==",
241+
"contentHash": "QhkXUl2gNrQtvPmtBTQHb0YsUrDiDQ2QS09YbtTTiSjGcf7NBqtYbrG/BE06zcBPCKEwQGzIv13IVdXNOSub2w=="
242+
},
243+
"System.Configuration.ConfigurationManager": {
244+
"type": "Transitive",
245+
"resolved": "9.0.1",
246+
"contentHash": "ntDQ+3A7vGq6jnv3KI8nv1Tfgmos9TG863xd/5tmms6LqrIxEze1RLuA3JB/AcpXMUSO70DXzXfPnJD2ZHFX0Q==",
240247
"dependencies": {
241-
"System.Diagnostics.EventLog": "9.0.0",
242-
"System.Security.Cryptography.ProtectedData": "9.0.0"
248+
"System.Diagnostics.EventLog": "9.0.1",
249+
"System.Security.Cryptography.ProtectedData": "9.0.1"
243250
}
244251
},
245252
"System.Diagnostics.EventLog": {
246253
"type": "Transitive",
247-
"resolved": "9.0.0",
248-
"contentHash": "qd01+AqPhbAG14KtdtIqFk+cxHQFZ/oqRSCoxU1F+Q6Kv0cl726sl7RzU9yLFGd4BUOKdN4XojXF0pQf/R6YeA=="
254+
"resolved": "9.0.1",
255+
"contentHash": "iVnDpgYJsRaRFnk77kcLA3+913WfWDtnAKrQl9tQ5ahqKANTaJKmQdsuPWWiAPWE9pk1Kj4Pg9JGXWfFYYyakQ=="
249256
},
250257
"System.Drawing.Common": {
251258
"type": "Transitive",
252-
"resolved": "8.0.0",
253-
"contentHash": "JkbHJjtI/dWc5dfmEdJlbe3VwgZqCkZRtfuWFh5GOv0f+gGCfBtzMpIVkmdkj2AObO9y+oiOi81UGwH3aBYuqA==",
259+
"resolved": "9.0.0",
260+
"contentHash": "uoozjI3+dlgKh2onFJcz8aNLh6TRCPlLSh8Dbuljc8CdvqXrxHOVysJlrHvlsOCqceqGBR1wrMPxlnzzhynktw==",
254261
"dependencies": {
255-
"Microsoft.Win32.SystemEvents": "8.0.0"
262+
"Microsoft.Win32.SystemEvents": "9.0.0"
256263
}
257264
},
258265
"System.Management": {
@@ -277,15 +284,23 @@
277284
"resolved": "4.7.0",
278285
"contentHash": "VR4kk8XLKebQ4MZuKuIni/7oh+QGFmZW3qORd1GvBq/8026OpW501SzT/oypwiQl4TvT8ErnReh/NzY9u+C6wQ=="
279286
},
287+
"System.Reflection.Metadata": {
288+
"type": "Transitive",
289+
"resolved": "9.0.0",
290+
"contentHash": "ANiqLu3DxW9kol/hMmTWbt3414t9ftdIuiIU7j80okq2YzAueo120M442xk1kDJWtmZTqWQn7wHDvMRipVOEOQ==",
291+
"dependencies": {
292+
"System.Collections.Immutable": "9.0.0"
293+
}
294+
},
280295
"System.Security.AccessControl": {
281296
"type": "Transitive",
282297
"resolved": "6.0.1",
283298
"contentHash": "IQ4NXP/B3Ayzvw0rDQzVTYsCKyy0Jp9KI6aYcK7UnGVlR9+Awz++TIPCQtPYfLJfOpm8ajowMR09V7quD3sEHw=="
284299
},
285300
"System.Security.Cryptography.ProtectedData": {
286301
"type": "Transitive",
287-
"resolved": "9.0.0",
288-
"contentHash": "CJW+x/F6fmRQ7N6K8paasTw9PDZp4t7G76UjGNlSDgoHPF0h08vTzLYbLZpOLEJSg35d5wy2jCXGo84EN05DpQ=="
302+
"resolved": "9.0.1",
303+
"contentHash": "u+4PH6GyDjEsWgcpKp1S/DiyxtGvazNPdaPFR6p6/qZr3TW+oZWvwfHO2H2CSpS4KGl2z2CBfU6eB38PsmoxtA=="
289304
},
290305
"System.Security.Principal.Windows": {
291306
"type": "Transitive",
@@ -322,7 +337,7 @@
322337
"CommunityToolkit.WinUI.Collections": "[8.1.240916, )",
323338
"CommunityToolkit.WinUI.Extensions": "[8.1.240916, )",
324339
"CommunityToolkit.WinUI.UI.Controls.DataGrid": "[7.1.2, )",
325-
"H.NotifyIcon.WinUI": "[2.0.131, )",
340+
"H.NotifyIcon.WinUI": "[2.2.0, )",
326341
"Microsoft.CSharp": "[4.7.0, )",
327342
"Microsoft.Extensions.DependencyInjection": "[9.0.0, )",
328343
"Microsoft.Toolkit.Uwp.Notifications": "[7.1.3, )",
@@ -331,9 +346,9 @@
331346
"NLog": "[5.3.4, )",
332347
"NLog.Web.AspNetCore": "[5.3.15, )",
333348
"Newtonsoft.Json": "[13.0.3, )",
334-
"Octokit": "[13.0.1, )",
349+
"Octokit": "[14.0.0, )",
335350
"Semver": "[3.0.0, )",
336-
"System.Configuration.ConfigurationManager": "[9.0.0, )",
351+
"System.Configuration.ConfigurationManager": "[9.0.1, )",
337352
"System.Management": "[9.0.0, )",
338353
"System.Private.Uri": "[4.3.2, )",
339354
"System.ServiceProcess.ServiceController": "[9.0.0, )",
@@ -358,8 +373,8 @@
358373
},
359374
"Microsoft.Win32.SystemEvents": {
360375
"type": "Transitive",
361-
"resolved": "8.0.0",
362-
"contentHash": "9opKRyOKMCi2xJ7Bj7kxtZ1r9vbzosMvRrdEhVhDz8j8MoBGgB+WmC94yH839NPH+BclAjtQ/pyagvi/8gDLkw=="
376+
"resolved": "9.0.0",
377+
"contentHash": "z8FfGIaoeALdD+KF44A2uP8PZIQQtDGiXsOLuN8nohbKhkyKt7zGaZb+fKiCxTuBqG22Q7myIAioSWaIcOOrOw=="
363378
},
364379
"Microsoft.WindowsAppSDK": {
365380
"type": "Transitive",
@@ -372,8 +387,8 @@
372387
},
373388
"System.Diagnostics.EventLog": {
374389
"type": "Transitive",
375-
"resolved": "9.0.0",
376-
"contentHash": "qd01+AqPhbAG14KtdtIqFk+cxHQFZ/oqRSCoxU1F+Q6Kv0cl726sl7RzU9yLFGd4BUOKdN4XojXF0pQf/R6YeA=="
390+
"resolved": "9.0.1",
391+
"contentHash": "iVnDpgYJsRaRFnk77kcLA3+913WfWDtnAKrQl9tQ5ahqKANTaJKmQdsuPWWiAPWE9pk1Kj4Pg9JGXWfFYYyakQ=="
377392
},
378393
"System.Management": {
379394
"type": "Transitive",

AutoStartConfirmTest/AppTest.cs

Lines changed: 146 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,146 @@
1+
//using AutoStartConfirm;
2+
//using AutoStartConfirm.Connectors;
3+
//using AutoStartConfirm.GUI;
4+
//using AutoStartConfirm.Helpers;
5+
//using AutoStartConfirm.Models;
6+
//using AutoStartConfirm.Notifications;
7+
//using AutoStartConfirm.Properties;
8+
//using AutoStartConfirm.Update;
9+
//using CommunityToolkit.Mvvm.DependencyInjection;
10+
//using FakeItEasy;
11+
//using Microsoft.Extensions.DependencyInjection;
12+
//using Microsoft.Extensions.Logging;
13+
using Microsoft.VisualStudio.TestTools.UnitTesting;
14+
15+
namespace AutoStartConfirmTests
16+
{
17+
[TestClass]
18+
public class AppTest
19+
{
20+
//private readonly ILogger<AutoStartConfirm.App> LogService = A.Fake<ILogger<AutoStartConfirm.App>>();
21+
//private readonly IAppStatus AppStatus = A.Fake<IAppStatus>();
22+
//private readonly IAutoStartBusiness AutoStartBusiness = A.Fake<IAutoStartBusiness>();
23+
//private readonly INotificationService NotificationService = A.Fake<INotificationService>();
24+
//private readonly IMessageService MessageService = A.Fake<IMessageService>();
25+
//private readonly ISettingsService SettingsService = A.Fake<ISettingsService>();
26+
//private readonly IUpdateService UpdateService = A.Fake<IUpdateService>();
27+
//private readonly IDispatchService DispatchService = A.Fake<IDispatchService>();
28+
29+
// private AutoStartConfirm.App? app;
30+
31+
[ClassInitialize]
32+
public static void ClassInitialize(TestContext context)
33+
{
34+
}
35+
36+
[TestInitialize]
37+
public void TestInitialize()
38+
{
39+
}
40+
41+
[TestCleanup]
42+
public void TestCleanup()
43+
{
44+
//Fake.ClearRecordedCalls(LogService);
45+
//Fake.ClearRecordedCalls(AppStatus);
46+
//Fake.ClearRecordedCalls(AutoStartBusiness);
47+
//Fake.ClearRecordedCalls(NotificationService);
48+
//Fake.ClearRecordedCalls(MessageService);
49+
//Fake.ClearRecordedCalls(SettingsService);
50+
//Fake.ClearRecordedCalls(UpdateService);
51+
//Fake.ClearRecordedCalls(DispatchService);
52+
53+
//app?.Dispose();
54+
//app = null;
55+
}
56+
57+
[ClassCleanup]
58+
public static void ClassCleanup()
59+
{
60+
}
61+
62+
//[UITestMethod()]
63+
//public void CanBeCreated()
64+
//{
65+
// //ServiceCollection services = new();
66+
// //services.AddSingleton<NotifyIcon>(sp => A.Fake<NotifyIcon>());
67+
// //services.AddSingleton<MainWindow>(sp => A.Fake<MainWindow>());
68+
// //var ServiceProvider = services.BuildServiceProvider();
69+
// //Ioc.Default.ConfigureServices(ServiceProvider);
70+
// //app = new AutoStartConfirm.App(
71+
// // logger: LogService,
72+
// // appStatus: AppStatus,
73+
// // autoStartService: AutoStartBusiness,
74+
// // notificationService: NotificationService,
75+
// // messageService: MessageService,
76+
// // settingsService: SettingsService,
77+
// // updateService: UpdateService,
78+
// // dispatchService: DispatchService
79+
// //);
80+
81+
// //app!.Run();
82+
//}
83+
84+
//[TestMethod]
85+
//public void Start_LoadsAutoStarts_And_StartsWatchers()
86+
//{
87+
// WinRT.ComWrappersSupport.InitializeComWrappers();
88+
// Microsoft.UI.Xaml.Application.Start((p) =>
89+
// {
90+
// ServiceCollection services = new();
91+
// services.AddSingleton<NotifyIcon>(sp => A.Fake<NotifyIcon>());
92+
// services.AddSingleton<MainWindow>(sp => A.Fake<MainWindow>());
93+
// var ServiceProvider = services.BuildServiceProvider();
94+
// Ioc.Default.ConfigureServices(ServiceProvider);
95+
// app = new App(
96+
// logger: LogService,
97+
// appStatus: AppStatus,
98+
// autoStartService: AutoStartBusiness,
99+
// notificationService: NotificationService,
100+
// messageService: MessageService,
101+
// settingsService: SettingsService,
102+
// updateService: UpdateService,
103+
// dispatchService: DispatchService
104+
// );
105+
106+
// app!.Run();
107+
// });
108+
109+
// A.CallTo(() => AutoStartBusiness.LoadCurrentAutoStarts()).MustHaveHappened();
110+
// A.CallTo(() => AutoStartBusiness.StartWatcher()).MustHaveHappened();
111+
//}
112+
113+
//[TestMethod]
114+
//public void Start_ChecksForUpdatesIfEnabled()
115+
//{
116+
// A.CallTo(() => SettingsService.CheckForUpdatesOnStart).Returns(true);
117+
// app!.Run();
118+
// A.CallTo(() => UpdateService.CheckUpdateAndShowNotification()).MustHaveHappened();
119+
//}
120+
121+
//[TestMethod]
122+
//public void Start_ChecksNotForUpdatesIfDisabled()
123+
//{
124+
// A.CallTo(() => SettingsService.CheckForUpdatesOnStart).Returns(false);
125+
// app!.Run();
126+
// A.CallTo(() => UpdateService.CheckUpdateAndShowNotification()).MustNotHaveHappened();
127+
//}
128+
129+
//[TestMethod]
130+
//public void ToggleOwnAutoStart_ShowsErrorMessageOnError()
131+
//{
132+
// A.CallTo(() => AutoStartBusiness.ToggleOwnAutoStart()).Throws(new Exception());
133+
// app!.ToggleOwnAutoStart().Wait();
134+
// A.CallTo(() => MessageService.ShowError(A<string>.Ignored, A<Exception>.Ignored)).MustHaveHappened();
135+
// Fake.ClearRecordedCalls(MessageService);
136+
//}
137+
138+
//[TestMethod]
139+
//public void ToggleOwnAutoStart_ShowsNoErrorMessageIfNoError()
140+
//{
141+
// app!.ToggleOwnAutoStart().Wait();
142+
// A.CallTo(() => MessageService.ShowError(A<string>.Ignored, A<Exception>.Ignored)).MustNotHaveHappened();
143+
// Fake.ClearRecordedCalls(MessageService);
144+
//}
145+
}
146+
}
432 Bytes
Loading
5.25 KB
Loading
1.71 KB
Loading
637 Bytes
Loading
283 Bytes
Loading
456 Bytes
Loading
2.05 KB
Loading

0 commit comments

Comments
 (0)