VsixTesting allows you to easily test your Visual Studio Extensions.
.csproj
<ItemGroup>
<PackageReference Include="xunit" Version="2.3.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.3.1" />
<PackageReference Include="VsixTesting.Xunit" Version="0.1.1-beta" />
<PackageReference Include="VSSDK.Shell.11" Version="11.0.4" />
</ItemGroup>
.cs
using Microsoft.VisualStudio.Shell;
using Microsoft.VisualStudio.Shell.Interop;
using Xunit;
namespace Tests
{
public class TestClass
{
[VsFact]
void FactTest()
=> Assert.NotNull(Package.GetGlobalService(typeof(SVsWebBrowsingService)));
[VsTheory]
[InlineData(123)]
void TheoryTest(int n)
{
Assert.NotNull(Package.GetGlobalService(typeof(SVsWebBrowsingService)));
Assert.Equal(123, n);
}
}
}
ITestSettings.cs implemented by
- VsTestSettingsAttribute.cs (for assemblies/collections/classes)
- VsFactAttribute.cs (for methods)
IInstanceSettings.cs implemented by
This repository is licensed with the Apache, Version 2.0 license.