winget-cli

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

OutOfProcAttribute.cs (2174B)


      1 // -----------------------------------------------------------------------------
      2 // <copyright file="OutOfProcAttribute.cs" company="Microsoft Corporation">
      3 //     Copyright (c) Microsoft Corporation. Licensed under the MIT License.
      4 // </copyright>
      5 // -----------------------------------------------------------------------------
      6 
      7 namespace Microsoft.Management.Configuration.UnitTests.Helpers
      8 {
      9     using System;
     10     using Xunit.Sdk;
     11 
     12     /// <summary>
     13     /// Trait used to mark a test as being able to run against the out of proc server.
     14     /// </summary>
     15     [TraitDiscoverer(OutOfProcDiscoverer.TypeName, Constants.AssemblyNameForTraits)]
     16     [AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, AllowMultiple = false)]
     17     public class OutOfProcAttribute : Attribute, ITraitAttribute
     18     {
     19         /// <summary>
     20         /// Initializes a new instance of the <see cref="OutOfProcAttribute"/> class.
     21         /// </summary>
     22         public OutOfProcAttribute()
     23         {
     24             // To run the tests OOP, you need to replace Microsoft.Management.Configuration.dll with Microsoft.Management.Configuration.OutOfProc.dll (renamed to remove the OutOfProc).
     25             // You will also need to copy over Microsoft.Management.Configuration.winmd as it is needed by COM.
     26             //
     27             // You can use the script to do this:
     28             //  <git root>\src\Microsoft.Management.Configuration.OutOfProc\Prepare-ConfigurationOOPTests.ps1 -BuildOutputPath <git root>\src\x64\Debug
     29             //
     30             // It can be easier to run the tests on the command line because any changes needing a recompile will overwrite the DLL update above.
     31             // The test runner is located somewhere like this:
     32             //  C:\Program Files\Microsoft Visual Studio\2022\Enterprise\Common7\IDE\Extensions\TestPlatform
     33             // and the command line from there is:
     34             //  .\vstest.console.exe "<location of your repo>\src\x64\Debug\Microsoft.Management.Configuration.UnitTests\net8.0-windows10.0.26100.0\Microsoft.Management.Configuration.UnitTests.dll" --TestCaseFilter:Category=OutOfProc
     35         }
     36     }
     37 }