vssdktestfx/doc/xunit.md

862 B

Xunit instructions

These instructions apply when consuming this test framework from an Xunit project. This is an addendum to general instructions outlined in our README.

  1. Install the NuGet package Microsoft.VisualStudio.Sdk.TestFramework.Xunit NuGet package

  2. For each of your test classes that rely on VS mocked services, apply the Collection attribute and add a parameter and statement to your constructor:

    using Microsoft.VisualStudio.Sdk.TestFramework;
    
    [Collection(MockedVS.Collection)]
    public class YourTestClass
    {
        public TestFrameworkTests(GlobalServiceProvider sp)
        {
            sp.Reset();
        }
    }