forked from vpnhood/VpnHood
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
22 changed files
with
233 additions
and
183 deletions.
There are no files selected for viewing
4 changes: 1 addition & 3 deletions
4
Src/Core/VpnHood.Core.Client.Device.WinDivert/WinDivertDevice.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
using VpnHood.Core.Client.Device; | ||
using VpnHood.Core.Common.Net; | ||
using VpnHood.Core.Common.Utils; | ||
using VpnHood.Test; | ||
using VpnHood.Test.Device; | ||
using VpnHood.Test.Providers; | ||
|
||
namespace VpnHood.AppLib.Test; | ||
|
||
public class TestAppHelper : TestHelper | ||
{ | ||
public static Task WaitForAppState(VpnHoodApp app, AppConnectionState connectionSate, int timeout = 5000) | ||
{ | ||
return VhTestUtil.AssertEqualsWait(connectionSate, () => app.State.ConnectionState, | ||
"App state didn't reach the expected value.", timeout); | ||
} | ||
|
||
public static AppOptions CreateAppOptions() | ||
{ | ||
var tracker = new TestTrackerProvider(); | ||
var appOptions = new AppOptions("com.vpnhood.client.test", isDebugMode: true) { | ||
StorageFolderPath = Path.Combine(WorkingPath, "AppData_" + Guid.CreateVersion7()), | ||
SessionTimeout = TimeSpan.FromSeconds(2), | ||
Ga4MeasurementId = null, | ||
Tracker = tracker, | ||
UseInternalLocationService = false, | ||
UseExternalLocationService = false, | ||
AllowEndPointTracker = true, | ||
LogVerbose = LogVerbose, | ||
ServerQueryTimeout = TimeSpan.FromSeconds(2), | ||
AutoDiagnose = false, | ||
SingleLineConsoleLog = false, | ||
CanExtendByRewardedAdThreshold = TimeSpan.Zero, | ||
AdOptions = new AppAdOptions { | ||
ShowAdPostDelay = TimeSpan.Zero, | ||
LoadAdPostDelay = TimeSpan.Zero | ||
} | ||
}; | ||
return appOptions; | ||
} | ||
|
||
public static VpnHoodApp CreateClientApp(AppOptions? appOptions = default, IDevice? device = default) | ||
{ | ||
appOptions ??= CreateAppOptions(); | ||
device ??= new TestDevice(() => new TestNullPacketCapture()); | ||
|
||
//create app | ||
var clientApp = VpnHoodApp.Init(device, appOptions); | ||
clientApp.Diagnoser.HttpTimeout = 2000; | ||
clientApp.Diagnoser.NsTimeout = 2000; | ||
clientApp.UserSettings.PacketCaptureIncludeIpRanges = TestIpAddresses.Select(x => new IpRange(x)).ToArray(); | ||
clientApp.UserSettings.Logging.LogAnonymous = false; | ||
clientApp.TcpTimeout = TimeSpan.FromSeconds(2); | ||
ActiveUiContext.Context = new TestAppUiContext(); | ||
|
||
return clientApp; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
using Microsoft.VisualStudio.TestTools.UnitTesting; | ||
using VpnHood.Test; | ||
|
||
namespace VpnHood.AppLib.Test; | ||
|
||
[TestClass] | ||
public class TestAssembly | ||
{ | ||
[AssemblyInitialize] | ||
public static void AssemblyInit(TestContext _) | ||
{ | ||
TestHelper.Init(); | ||
} | ||
|
||
[AssemblyCleanup] | ||
public static void AssemblyCleanup() | ||
{ | ||
TestHelper.Cleanup(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.