using System.Diagnostics; using System.IO; using ComputeSharp.Tests.NativeLibrariesResolver.Helpers; using Microsoft.VisualStudio.TestTools.UnitTesting; namespace ComputeSharp.Tests.NativeLibrariesResolver; [TestClass] public class DynamicNativeLibrariesResolverTests : NativeLibrariesResolverTestsBase { /// protected override string SampleProjectName => "ComputeSharp.Dynamic.NuGet"; /// /// Performs static initialization for the assembly before any unit tests are run. /// /// The for the test runner instance in use. [ClassInitialize] public static void InitializeDynamicDependencies(TestContext _) { string path = Path.GetDirectoryName(typeof(DynamicNativeLibrariesResolverTests).Assembly.Location)!; while (Path.GetFileName(path) is not "ComputeSharp") { path = Path.GetDirectoryName(path)!; } string corePackagingProjectPath = Path.Combine(path, "src", "ComputeSharp.Core", "ComputeSharp.Core.msbuildproj"); string packagingProjectPath = Path.Combine(path, "src", "ComputeSharp.Package", "ComputeSharp.Package.msbuildproj"); string dynamicPackagingProjectPath = Path.Combine(path, "src", "ComputeSharp.Dynamic.Package", "ComputeSharp.Dynamic.Package.msbuildproj"); // Run dotnet pack and on the packaging projects, to ensure the local NuGet packages are available Process.Start("dotnet", $"pack {corePackagingProjectPath} -c Release").WaitForExit(); Process.Start("dotnet", $"pack {packagingProjectPath} -c Release").WaitForExit(); Process.Start("dotnet", $"pack {dynamicPackagingProjectPath} -c Release").WaitForExit(); } }