From 88b92e2cb88669feaba43d993b0add5d42706e77 Mon Sep 17 00:00:00 2001 From: David Hall Date: Thu, 17 Oct 2019 09:16:09 -0600 Subject: [PATCH] Added throttling app support --- UnitTests/CSharpRunner/TestHelper.cs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/UnitTests/CSharpRunner/TestHelper.cs b/UnitTests/CSharpRunner/TestHelper.cs index fbd7d5d6..8bad6a9b 100644 --- a/UnitTests/CSharpRunner/TestHelper.cs +++ b/UnitTests/CSharpRunner/TestHelper.cs @@ -2,14 +2,26 @@ using NUnit.Framework; using System; using System.Collections.Generic; +using System.Diagnostics; using System.Linq; using System.Runtime.InteropServices; +using System.Threading; using Vanara.InteropServices; namespace Vanara.PInvoke.Tests { public static class TestHelper { + private const string testApp = @"C:\Users\dahall\Documents\Visual Studio 2017\Projects\TestSysConsumption\bin\Debug\netcoreapp3.0\TestSysConsumption.exe"; + + public static Process RunThrottleApp() => Process.Start(testApp); + + public static void SetThrottle(string type, bool on) + { + using (var evt = new EventWaitHandle(false, EventResetMode.AutoReset, (on ? "" : "End") + type)) + evt.Set(); + } + public static IList GetNestedStructSizes(this Type type, params string[] filters) { var output = new List();