-
-
Notifications
You must be signed in to change notification settings - Fork 263
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add package Roslynator.Testing.CSharp.MSTest (#997)
- Loading branch information
1 parent
1841fa7
commit 943a320
Showing
17 changed files
with
184 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
src/Tests/Testing.CSharp.MSTest/Testing.CSharp.MSTest.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>netstandard2.0</TargetFramework> | ||
<Version>$(RoslynatorTestingVersion)</Version> | ||
<AssemblyName>Roslynator.Testing.CSharp.MSTest</AssemblyName> | ||
<RootNamespace>Roslynator.Testing.CSharp.MSTest</RootNamespace> | ||
</PropertyGroup> | ||
|
||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'"> | ||
<Deterministic>true</Deterministic> | ||
<TreatWarningsAsErrors>true</TreatWarningsAsErrors> | ||
<WarningsNotAsErrors>1591</WarningsNotAsErrors> | ||
<DocumentationFile>bin\$(Configuration)\netstandard2.0\Roslynator.Testing.CSharp.MSTest.xml</DocumentationFile> | ||
</PropertyGroup> | ||
|
||
<PropertyGroup> | ||
<PackageId>Roslynator.Testing.CSharp.MSTest</PackageId> | ||
<PackageVersion>$(RoslynatorTestingPackageVersion)</PackageVersion> | ||
<Company></Company> | ||
<Description>Testing framework for Roslyn analyzers, refactorings and code fixes.</Description> | ||
<PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance> | ||
<PackageLicenseExpression>Apache-2.0</PackageLicenseExpression> | ||
<PackageProjectUrl>https://github.com/josefpihrt/roslynator</PackageProjectUrl> | ||
<PackageIcon>icon.png</PackageIcon> | ||
<PackageReleaseNotes></PackageReleaseNotes> | ||
<PackageTags>Roslyn;CodeAnalysis;Test;UnitTest</PackageTags> | ||
<PackageReadmeFile>docs/README.md</PackageReadmeFile> | ||
<RepositoryUrl>https://github.com/josefpihrt/roslynator.git</RepositoryUrl> | ||
<RepositoryType>git</RepositoryType> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="MSTest.TestFramework" Version="2.2.10" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\Testing.CSharp\Testing.CSharp.csproj" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<None Include="..\..\..\images\icon.png" Pack="true" PackagePath="\" Visible="false" /> | ||
<None Include="docs\NuGetReadme.md" Pack="true" PackagePath="docs\README.md" /> | ||
</ItemGroup> | ||
|
||
</Project> |
18 changes: 18 additions & 0 deletions
18
src/Tests/Testing.CSharp.MSTest/Testing/CSharp/MSTest/MSTestAssert.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// Copyright (c) Josef Pihrt and Contributors. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. | ||
|
||
namespace Roslynator.Testing.CSharp.MSTest; | ||
|
||
internal class MSTestAssert : IAssert | ||
{ | ||
public static MSTestAssert Instance { get; } = new(); | ||
|
||
public void Equal(string expected, string actual) | ||
{ | ||
global::Microsoft.VisualStudio.TestTools.UnitTesting.Assert.AreEqual(expected, actual); | ||
} | ||
|
||
public void True(bool condition, string userMessage) | ||
{ | ||
global::Microsoft.VisualStudio.TestTools.UnitTesting.Assert.IsTrue(condition, userMessage); | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
src/Tests/Testing.CSharp.MSTest/Testing/CSharp/MSTest/MSTestCompilerDiagnosticFixVerifier.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// Copyright (c) Josef Pihrt and Contributors. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. | ||
|
||
using Microsoft.CodeAnalysis.CodeFixes; | ||
|
||
namespace Roslynator.Testing.CSharp.MSTest; | ||
|
||
/// <summary> | ||
/// Represents a verifier for C# compiler diagnostics. | ||
/// </summary> | ||
public abstract class MSTestCompilerDiagnosticFixVerifier<TFixProvider> : CSharpCompilerDiagnosticFixVerifier<TFixProvider> | ||
where TFixProvider : CodeFixProvider, new() | ||
{ | ||
/// <summary> | ||
/// Initializes a new instance of <see cref="MSTestCompilerDiagnosticFixVerifier{TFixProvider}"/> | ||
/// </summary> | ||
protected MSTestCompilerDiagnosticFixVerifier() : base(MSTestAssert.Instance) | ||
{ | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
src/Tests/Testing.CSharp.MSTest/Testing/CSharp/MSTest/MSTestDiagnosticVerifier.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// Copyright (c) Josef Pihrt and Contributors. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. | ||
|
||
using Microsoft.CodeAnalysis.CodeFixes; | ||
using Microsoft.CodeAnalysis.Diagnostics; | ||
|
||
namespace Roslynator.Testing.CSharp.MSTest; | ||
|
||
/// <summary> | ||
/// Represents a verifier for a C# diagnostic that is produced by <see cref="DiagnosticAnalyzer"/>. | ||
/// </summary> | ||
public abstract class MSTestDiagnosticVerifier<TAnalyzer, TFixProvider> : CSharpDiagnosticVerifier<TAnalyzer, TFixProvider> | ||
where TAnalyzer : DiagnosticAnalyzer, new() | ||
where TFixProvider : CodeFixProvider, new() | ||
{ | ||
/// <summary> | ||
/// Initializes a new instance of <see cref="MSTestDiagnosticVerifier{TAnalyzer, TFixProvider}"/>. | ||
/// </summary> | ||
protected MSTestDiagnosticVerifier() : base(MSTestAssert.Instance) | ||
{ | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
src/Tests/Testing.CSharp.MSTest/Testing/CSharp/MSTest/MSTestRefactoringVerifier.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// Copyright (c) Josef Pihrt and Contributors. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. | ||
|
||
using Microsoft.CodeAnalysis.CodeRefactorings; | ||
|
||
namespace Roslynator.Testing.CSharp.MSTest; | ||
|
||
/// <summary> | ||
/// Represents verifier for a C# code refactoring. | ||
/// </summary> | ||
public abstract class MSTestRefactoringVerifier<TRefactoringProvider> : CSharpRefactoringVerifier<TRefactoringProvider> | ||
where TRefactoringProvider : CodeRefactoringProvider, new() | ||
{ | ||
/// <summary> | ||
/// Initializes a new instance of <see cref="MSTestRefactoringVerifier{TRefactoringProvider}"/>. | ||
/// </summary> | ||
protected MSTestRefactoringVerifier() : base(MSTestAssert.Instance) | ||
{ | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# Roslynator.Testing.CSharp.MSTest | ||
|
||
Test framework for unit testing of [Roslyn](https://github.com/dotnet/roslyn) analyzers, refactorings and code fixes. | ||
|
||
## Usage | ||
|
||
Learn how to use the framework from actual usages in Roslynator repository: | ||
|
||
* Tests of analyzers are [here](https://github.com/josefpihrt/roslynator/tree/main/src/Tests/Analyzers.Tests), [here](https://github.com/josefpihrt/roslynator/tree/main/src/Tests/CodeAnalysis.Analyzers.Tests) and [here](https://github.com/josefpihrt/roslynator/tree/main/src/Tests/Formatting.Analyzers.Tests). | ||
* Tests of refactorings are [here](https://github.com/josefpihrt/roslynator/tree/main/src/Tests/Refactorings.Tests). | ||
* Tests of fixes of compiler diagnostics are [here](https://github.com/josefpihrt/roslynator/tree/main/src/Tests/CodeFixes.Tests). | ||
|
||
## Feedback | ||
|
||
* File an issue on [GitHub](https://github.com/josefpihrt/roslynator/issues/new) | ||
* Follow on [Twitter](https://twitter.com/roslynator) | ||
|
||
## Related Products | ||
|
||
* [Roslynator for Visual Studio 2022](https://marketplace.visualstudio.com/items?itemName=josefpihrt.Roslynator2022) | ||
* [Roslynator for VS Code](https://marketplace.visualstudio.com/items?itemName=josefpihrt-vscode.roslynator) | ||
* [Roslynator Command-line Tool](https://www.nuget.org/packages/Roslynator.DotNet.Cli) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.