Skip to content

Commit

Permalink
Adding Unit test scaffold
Browse files Browse the repository at this point in the history
  • Loading branch information
James Bristow committed Feb 8, 2024
1 parent 9d860c8 commit c63fd0b
Show file tree
Hide file tree
Showing 6 changed files with 74 additions and 14 deletions.
46 changes: 46 additions & 0 deletions .github/workflows/unit-tests.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Unit Tests

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
release:
types: [ published ]
workflow_dispatch: {}

permissions:
actions: write
contents: write

jobs:
build:
runs-on: ubuntu-latest
strategy:
max-parallel: 16

steps:
- uses: actions/checkout@v3

- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: 6.0.x

- name: Restore dependencies
run: dotnet restore

- name: Build
run: dotnet build --no-restore

- name: run
run: |
dotnet test --test-adapter-path:. --logger:"junit;LogFilePath=/tmp/unit_results.xml"
- name: Test Report
uses: dorny/test-reporter@v1
if: success()
with:
name: Unit Tests
path: /tmp/unit_results.xml
reporter: java-junit
1 change: 0 additions & 1 deletion SVSModel.Tests/GlobalUsings.cs

This file was deleted.

5 changes: 2 additions & 3 deletions SVSModel.Tests/SVSModel.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,14 @@

<PropertyGroup>
<TargetFramework>net48</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>

<IsPackable>false</IsPackable>
<IsTestProject>true</IsTestProject>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="JunitXml.TestLogger" Version="3.0.134" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.7.1" />
<PackageReference Include="Microsoft.TestPlatform.ObjectModel" Version="17.9.0" />
<PackageReference Include="xunit" Version="2.4.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
Expand Down
20 changes: 20 additions & 0 deletions SVSModel.Tests/SVSModelTest.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
using Xunit;
using System;

namespace SVSModel.Tests
{
public class SVSModelTest
{
[Fact]
public void Test1()
{
Assert.True(true);
}

[Fact]
public void Test2()
{
Assert.True(true);
}
}
}
10 changes: 0 additions & 10 deletions SVSModel.Tests/UnitTest1.cs

This file was deleted.

6 changes: 6 additions & 0 deletions SVSModel.sln
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TestsConsole", "TestConsole
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TestComponents", "TestComponents\TestComponents.csproj", "{B3488A79-46B6-4AE0-A327-1EFA5F850075}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SVSModel.Tests", "SVSModel.Tests\SVSModel.Tests.csproj", "{1E04368C-6819-4263-853D-CDE9AECDFA2F}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -40,6 +42,10 @@ Global
{B3488A79-46B6-4AE0-A327-1EFA5F850075}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B3488A79-46B6-4AE0-A327-1EFA5F850075}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B3488A79-46B6-4AE0-A327-1EFA5F850075}.Release|Any CPU.Build.0 = Release|Any CPU
{1E04368C-6819-4263-853D-CDE9AECDFA2F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1E04368C-6819-4263-853D-CDE9AECDFA2F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1E04368C-6819-4263-853D-CDE9AECDFA2F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1E04368C-6819-4263-853D-CDE9AECDFA2F}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down

0 comments on commit c63fd0b

Please sign in to comment.