1
0
Fork 0
mirror of https://github.com/dorny/test-reporter.git synced 2026-03-22 16:02:13 +01:00
test-reporter/reports/dotnet-nunit-legacy/NUnitLegacyTests/CalculatorTests.cs
2025-03-05 09:46:34 -06:00

71 lines
1.4 KiB
C#

using MyLibrary;
using NUnit.Framework;
using System;
using System.Threading;
namespace NUnitLegacyTests
{
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);
}
[Test]
public void Inconclusive_Test()
{
Assert.Inconclusive("couldn't run test for some reason");
}
}
}