From a83946e1966d946a28c3aa41a3a4992c98035622 Mon Sep 17 00:00:00 2001 From: pinzart90 Date: Tue, 31 Dec 2024 23:44:25 -0500 Subject: [PATCH] update --- test/DynamoCoreTests/DynamoCoreTests.csproj | 21 ++----- .../Logging/AnalyticsServiceTest.cs | 60 ++++++------------- 2 files changed, 24 insertions(+), 57 deletions(-) diff --git a/test/DynamoCoreTests/DynamoCoreTests.csproj b/test/DynamoCoreTests/DynamoCoreTests.csproj index 1e6124bce11..678a9b0f7c0 100644 --- a/test/DynamoCoreTests/DynamoCoreTests.csproj +++ b/test/DynamoCoreTests/DynamoCoreTests.csproj @@ -49,7 +49,6 @@ all compile; build; native; contentfiles; analyzers; buildtransitive - @@ -139,18 +138,10 @@ - - - - - - - - - - - - - - + + + + + + diff --git a/test/DynamoCoreTests/Logging/AnalyticsServiceTest.cs b/test/DynamoCoreTests/Logging/AnalyticsServiceTest.cs index 3d77c350e6e..7d653f04461 100644 --- a/test/DynamoCoreTests/Logging/AnalyticsServiceTest.cs +++ b/test/DynamoCoreTests/Logging/AnalyticsServiceTest.cs @@ -2,13 +2,10 @@ using System.Collections.Generic; using System.Diagnostics; using System.IO; -using System.Linq; using System.Reflection; using System.Runtime.InteropServices; using System.Threading; -using Microsoft.Diagnostics.Runtime; using NUnit.Framework; -using System.Runtime.Versioning; namespace Dynamo.Tests.Loggings { @@ -41,42 +38,29 @@ public void DisableAnalytics() { DynamoShapeManager.Utilities.GetInstalledAsmVersion2(versions, ref locatedPath, coreDirectory); } + try { - Assert.DoesNotThrow(() => - { + dynamoCLI = Process.Start(new ProcessStartInfo(Path.Combine(coreDirectory, "DynamoCLI.exe"), $"--GeometryPath \"{locatedPath}\" -k --DisableAnalytics -o \"{openPath}\" ") { UseShellExecute = true }); - dynamoCLI = Process.Start(new ProcessStartInfo(Path.Combine(coreDirectory, "DynamoCLI.exe"), $"--GeometryPath \"{locatedPath}\" -k --DisableAnalytics -o \"{openPath}\" ") { UseShellExecute = true }); - - Thread.Sleep(5000);// Wait 5 seconds to open the dyn - Assert.IsFalse(dynamoCLI.HasExited); - var dt = DataTarget.AttachToProcess(dynamoCLI.Id, false); - var assemblies = dt - .ClrVersions - .Select(dtClrVersion => dtClrVersion.CreateRuntime()) - .SelectMany(runtime => runtime.AppDomains.SelectMany(runtimeAppDomain => runtimeAppDomain.Modules)) - .Select(clrModule => clrModule.AssemblyName) - .Distinct() - .Where(x => x != null) - .ToList(); + Thread.Sleep(5000);// Wait 5 seconds to open the dyn + Assert.IsFalse(dynamoCLI.HasExited); - var firstASMmodulePath = string.Empty; - foreach (string module in assemblies) + var firstASMmodulePath = string.Empty; + foreach (ProcessModule module in dynamoCLI.Modules) + { + if (module.ModuleName.IndexOf("Analytics.dll", StringComparison.OrdinalIgnoreCase) != -1) { - if (module.IndexOf("Analytics", StringComparison.OrdinalIgnoreCase) != -1) - { - Assert.Fail("Analytics module was loaded"); - } - if (module.IndexOf("AdpSDKCSharpWrapper", StringComparison.OrdinalIgnoreCase) != -1) - { - Assert.Fail("ADP module was loaded"); - } + Assert.Fail("Analytics module was loaded"); } - }); + if (module.ModuleName.IndexOf("AdpSDKCSharpWrapper.dll", StringComparison.OrdinalIgnoreCase) != -1) + { + Assert.Fail("ADP module was loaded"); + } + } } finally { - dynamoCLI?.Kill(); } } @@ -116,25 +100,17 @@ public void DisableAnalyticsViaNoNetWorkMode() dynamoCLI = Process.Start(new ProcessStartInfo(Path.Combine(coreDirectory, "DynamoCLI.exe"), $"--GeometryPath \"{locatedPath}\" -k --NoNetworkMode -o \"{openPath}\" ") { UseShellExecute = true }); Thread.Sleep(5000);// Wait 5 seconds to open the dyn + Assert.IsFalse(dynamoCLI.HasExited); - var dt = DataTarget.AttachToProcess(dynamoCLI.Id, false); - var assemblies = dt - .ClrVersions - .Select(dtClrVersion => dtClrVersion.CreateRuntime()) - .SelectMany(runtime => runtime.AppDomains.SelectMany(runtimeAppDomain => runtimeAppDomain.Modules)) - .Select(clrModule => clrModule.AssemblyName) - .Distinct() - .Where(x => x != null) - .ToList(); var firstASMmodulePath = string.Empty; - foreach (string module in assemblies) + foreach (ProcessModule module in dynamoCLI.Modules) { - if (module.IndexOf("Analytics", StringComparison.OrdinalIgnoreCase) != -1) + if (module.ModuleName.IndexOf("Analytics.dll", StringComparison.OrdinalIgnoreCase) != -1) { Assert.Fail("Analytics module was loaded"); } - if (module.IndexOf("AdpSDKCSharpWrapper", StringComparison.OrdinalIgnoreCase) != -1) + if (module.ModuleName.IndexOf("AdpSDKCSharpWrapper.dll", StringComparison.OrdinalIgnoreCase) != -1) { Assert.Fail("ADP module was loaded"); }