Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ jobs:
contents: read

strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest]

Expand All @@ -56,11 +57,11 @@ jobs:
run: dotnet build -p:ContinuousIntegrationBuild=True --no-restore --configuration Release

- name: Test
run: dotnet test --no-build --configuration Release --verbosity normal
run: dotnet test --no-build --configuration Release --verbosity normal --coverage --coverage-output-format cobertura

- name: AOT Publish Validation
run: |
$rid = if ($env:RUNNER_OS -eq 'Windows') { 'win-x64' } else { 'linux-x64' }
dotnet publish TrxLib.AotSample/TrxLib.AotSample.csproj -r $rid -c Release --self-contained
$ext = if ($env:RUNNER_OS -eq 'Windows') { '.exe' } else { '' }
& "TrxLib.AotSample/bin/Release/net10.0/$rid/publish/TrxLib.AotSample$ext"
& "TrxLib.AotSample/bin/Release/net10.0/$rid/publish/TrxLib.AotSample$ext"
13 changes: 2 additions & 11 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,10 @@
-->
<ItemGroup>
<PackageVersion Include="AwesomeAssertions" Version="9.4.0" />
<PackageVersion Include="coverlet.collector" Version="10.0.0">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageVersion>
<PackageVersion Include="IntelliTect.Multitool" Version="2.0.0" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="18.5.1" />
<PackageVersion Include="Microsoft.SourceLink.GitHub" Version="10.0.203" />
<PackageVersion Include="Moq" Version="4.20.70" />
<PackageVersion Include="Moq.AutoMock" Version="3.5.0" />
<PackageVersion Include="xunit" Version="2.9.3" />
<PackageVersion Include="xunit.runner.visualstudio" Version="3.1.5">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageVersion>
<PackageVersion Include="TUnit" Version="1.44.39" />
</ItemGroup>
</Project>
</Project>
15 changes: 0 additions & 15 deletions TrxLib.Tests/ConditionalFactAttribute.cs

This file was deleted.

205 changes: 0 additions & 205 deletions TrxLib.Tests/ConditionalFactDiscoverer.cs

This file was deleted.

21 changes: 21 additions & 0 deletions TrxLib.Tests/OperatingSystemSkipAttributes.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
using System.Runtime.InteropServices;

using TUnit.Core;

namespace TrxLib.Tests;

public sealed class WindowsOnlyAttribute() : SkipAttribute("This test is only supported on Windows")
{
public override Task<bool> ShouldSkip(TestRegisteredContext context)
{
return Task.FromResult(!RuntimeInformation.IsOSPlatform(OSPlatform.Windows));
}
}

public sealed class NonWindowsOnlyAttribute() : SkipAttribute("This test is only supported on non-Windows platforms")
{
public override Task<bool> ShouldSkip(TestRegisteredContext context)
{
return Task.FromResult(RuntimeInformation.IsOSPlatform(OSPlatform.Windows));
}
}
48 changes: 24 additions & 24 deletions TrxLib.Tests/TestResultTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ namespace TrxLib.Tests;

public class TestResultTests
{
[Theory]
[InlineData("namespace.class.test", "namespace")]
[InlineData("deeper.namespace.class.test", "deeper.namespace")]
[InlineData("still.deeper.namespace.class.test", "still.deeper.namespace")]
[Test]
[Arguments("namespace.class.test", "namespace")]
[Arguments("deeper.namespace.class.test", "deeper.namespace")]
[Arguments("still.deeper.namespace.class.test", "still.deeper.namespace")]
public void Namespace_is_parsed_correctly(
string fullyQualifiedTestName,
string expectedNamespace)
Expand All @@ -17,33 +17,33 @@ public void Namespace_is_parsed_correctly(
testResult.Namespace.Should().Be(expectedNamespace);
}

[Theory]
[InlineData("namespace.class.test")]
[InlineData("deeper.namespace.class.test")]
[InlineData("still.deeper.namespace.class.test")]
[Test]
[Arguments("namespace.class.test")]
[Arguments("deeper.namespace.class.test")]
[Arguments("still.deeper.namespace.class.test")]
public void TestName_is_parsed_correctly(
string fullyQualifiedTestName)
{
var testResult = new TestResult(fullyQualifiedTestName, TestOutcome.NotExecuted);
testResult.TestName.Should().Be("test");
}

[Theory]
[InlineData("namespace.class.test")]
[InlineData("deeper.namespace.class.test")]
[InlineData("still.deeper.namespace.class.test")]
[Test]
[Arguments("namespace.class.test")]
[Arguments("deeper.namespace.class.test")]
[Arguments("still.deeper.namespace.class.test")]
public void ClassName_is_parsed_correctly(
string fullyQualifiedTestName)
{
var testResult = new TestResult(fullyQualifiedTestName, TestOutcome.NotExecuted);
testResult.ClassName.Should().Be("class");
}

[Theory]
[InlineData("namespace.class.test", "namespace.class")]
[InlineData("deeper.namespace.class.test", "deeper.namespace.class")]
[InlineData("still.deeper.namespace.class.test", "still.deeper.namespace.class")]
[InlineData("deeper.namespace.class.theorytest(command: \"build\")", "deeper.namespace.class")]
[Test]
[Arguments("namespace.class.test", "namespace.class")]
[Arguments("deeper.namespace.class.test", "deeper.namespace.class")]
[Arguments("still.deeper.namespace.class.test", "still.deeper.namespace.class")]
[Arguments("deeper.namespace.class.theorytest(command: \"build\")", "deeper.namespace.class")]
public void FullyQualifiedClassName_is_parsed_correctly(
string fullyQualifiedTestName,
string expected)
Expand All @@ -52,7 +52,7 @@ public void FullyQualifiedClassName_is_parsed_correctly(
testResult.FullyQualifiedClassName.Should().Be(expected);
}

[Fact]
[Test]
public void Theory_test_is_parsed_correctly()
{
var testResult = new TestResult(
Expand All @@ -65,9 +65,9 @@ public void Theory_test_is_parsed_correctly()
testResult.ClassName.Should().Be("GivenDotnetInvokesMSBuild");
}

[Theory]
[InlineData("Cell 1: #r \"nuget:TRexLib\"")]
[InlineData("Cell 1: Console.Write(\"Hello world.\";")]
[Test]
[Arguments("Cell 1: #r \"nuget:TRexLib\"")]
[Arguments("Cell 1: Console.Write(\"Hello world.\";")]
public void Inferred_properties_are_not_inferred_from_fully_qualified_test_name_if_they_do_not_match_dotnet_standards(
string fullyQualifiedTestName)
{
Expand All @@ -78,7 +78,7 @@ public void Inferred_properties_are_not_inferred_from_fully_qualified_test_name_
testResult.TestName.Should().Be(fullyQualifiedTestName);
}

[Fact]
[Test]
public void Theory_test_with_dotted_param_is_parsed_correctly_when_testMethod_provided()
{
// When testMethod is supplied the constructor must use testMethod.ClassName
Expand All @@ -99,7 +99,7 @@ public void Theory_test_with_dotted_param_is_parsed_correctly_when_testMethod_pr
testResult.TestName.Should().Be($"{methodName}(param: \"foo.bar\")");
}

[Fact]
[Test]
public void ToString_DoesNotThrow_ForOutcomeValueNotInEnum()
{
// TestResult.ToString() has a _ => throw arm that crashes on any enum value
Expand All @@ -109,4 +109,4 @@ public void ToString_DoesNotThrow_ForOutcomeValueNotInEnum()
var act = () => testResult.ToString();
act.Should().NotThrow<ArgumentOutOfRangeException>();
}
}
}
Loading
Loading