mirror of
https://github.com/dorny/test-reporter.git
synced 2025-12-16 14:27:10 +01:00
Add NUnit XML results fixtures
This commit is contained in:
parent
0d00bb14cb
commit
e6a3c0ca2e
6 changed files with 327 additions and 0 deletions
64
reports/dotnet/DotnetTests.NUnitV3Tests/CalculatorTests.cs
Normal file
64
reports/dotnet/DotnetTests.NUnitV3Tests/CalculatorTests.cs
Normal file
|
|
@ -0,0 +1,64 @@
|
|||
using System;
|
||||
using System.Threading;
|
||||
using DotnetTests.Unit;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace DotnetTests.XUnitTests
|
||||
{
|
||||
public class CalculatorTests
|
||||
{
|
||||
private readonly Calculator _calculator = new Calculator();
|
||||
|
||||
[Test]
|
||||
public void Passing_Test()
|
||||
{
|
||||
Assert.That(_calculator.Sum(1, 1), Is.EqualTo(2));
|
||||
}
|
||||
|
||||
[Test(Description = "Some description")]
|
||||
public void Passing_Test_With_Description()
|
||||
{
|
||||
Assert.That(2, Is.EqualTo(2));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Failing_Test()
|
||||
{
|
||||
Assert.That(_calculator.Sum(1, 1), Is.EqualTo(3));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Exception_In_TargetTest()
|
||||
{
|
||||
_calculator.Div(1, 0);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Exception_In_Test()
|
||||
{
|
||||
throw new Exception("Test");
|
||||
}
|
||||
|
||||
[Test]
|
||||
[Timeout(1)]
|
||||
public void Timeout_Test()
|
||||
{
|
||||
Thread.Sleep(100);
|
||||
}
|
||||
|
||||
[Test]
|
||||
[Ignore("Skipped")]
|
||||
public void Skipped_Test()
|
||||
{
|
||||
throw new Exception("Test");
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[TestCase(2)]
|
||||
[TestCase(3)]
|
||||
public void Is_Even_Number(int i)
|
||||
{
|
||||
Assert.True(i % 2 == 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||
|
||||
<IsPackable>false</IsPackable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="NUnit" Version="3.13.2" />
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.5.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\DotnetTests.Unit\DotnetTests.Unit.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
Loading…
Add table
Add a link
Reference in a new issue