mirror of
https://github.com/dorny/test-reporter.git
synced 2025-12-16 06:17:10 +01:00
Add dotnet-trx fixture project
This commit is contained in:
parent
6aba2a4454
commit
62ec9da2d6
10 changed files with 676 additions and 3 deletions
54
reports/dotnet/DotnetTests.XUnitTests/CalculatorTests.cs
Normal file
54
reports/dotnet/DotnetTests.XUnitTests/CalculatorTests.cs
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
using System;
|
||||
using System.Threading;
|
||||
using DotnetTests.Unit;
|
||||
using Xunit;
|
||||
|
||||
namespace DotnetTests.XUnitTests
|
||||
{
|
||||
public class CalculatorTests
|
||||
{
|
||||
private readonly Calculator _calculator = new Calculator();
|
||||
|
||||
[Fact]
|
||||
public void Passing_Test()
|
||||
{
|
||||
Assert.Equal(2, _calculator.Sum(1,1));
|
||||
}
|
||||
|
||||
[Fact(DisplayName = "Custom Name")]
|
||||
public void Passing_Test_With_Name()
|
||||
{
|
||||
Assert.Equal(2, _calculator.Sum(1, 1));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Failing_Test()
|
||||
{
|
||||
Assert.Equal(3, _calculator.Sum(1, 1));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Exception_In_TargetTest()
|
||||
{
|
||||
_calculator.Div(1, 0);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Exception_In_Test()
|
||||
{
|
||||
throw new Exception("Test");
|
||||
}
|
||||
|
||||
[Fact(Timeout = 1)]
|
||||
public void Timeout_Test()
|
||||
{
|
||||
Thread.Sleep(100);
|
||||
}
|
||||
|
||||
[Fact(Skip = "Skipped test")]
|
||||
public void Skipped_Test()
|
||||
{
|
||||
throw new Exception("Test");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||
|
||||
<IsPackable>false</IsPackable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.5.0" />
|
||||
<PackageReference Include="xunit" Version="2.4.0" />
|
||||
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.0" />
|
||||
<PackageReference Include="coverlet.collector" Version="1.2.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\DotnetTests.Unit\DotnetTests.Unit.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
Loading…
Add table
Add a link
Reference in a new issue