Skip to content

Commit 6d21414

Browse files
Merge pull request #11 from Yellow-Dog-Man/prime/feat/tests
feat(tests): add basic test setup
2 parents 6f07cba + 650da92 commit 6d21414

19 files changed

+63
-9
lines changed

.github/workflows/build..yml

+12-1
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,21 @@ on:
1414

1515
jobs:
1616
build:
17-
runs-on: windows-latest
17+
name: build-and-test-${{matrix.os}}
18+
runs-on: ${{ matrix.os }}
19+
env:
20+
BUILD_RUNTIME: ${{ matrix.os == 'ubuntu-latest' && 'linux-x64' || 'windows-x64' }}
21+
strategy:
22+
matrix:
23+
os: [ubuntu-latest, windows-latest]
1824
steps:
1925
- uses: actions/checkout@v4
26+
- uses: actions/setup-dotnet@v4
27+
with:
28+
dotnet-version: 9.x
2029
- name: Install dependencies
2130
run: dotnet restore
2231
- name: Build
2332
run: dotnet build --configuration Release --no-restore
33+
- name: Test
34+
run: dotnet test --no-restore --configuration Release

Compressonator.NET.Samples/Compressonator.NET.Samples.csproj

+1-2
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,10 @@
22

33
<PropertyGroup>
44
<OutputType>Exe</OutputType>
5-
<TargetFramework>net8.0</TargetFramework>
5+
<TargetFramework>net9.0</TargetFramework>
66
<ImplicitUsings>enable</ImplicitUsings>
77
<Nullable>enable</Nullable>
88
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
9-
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
109
</PropertyGroup>
1110

1211
<ItemGroup>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<TargetFramework>net9.0</TargetFramework>
5+
<LangVersion>latest</LangVersion>
6+
<ImplicitUsings>enable</ImplicitUsings>
7+
<Nullable>enable</Nullable>
8+
</PropertyGroup>
9+
10+
<ItemGroup>
11+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.11.1" />
12+
<PackageReference Include="MSTest" Version="3.6.1" />
13+
</ItemGroup>
14+
15+
<ItemGroup>
16+
<ProjectReference Include="..\Compressonator.NET\Compressonator.NET.csproj" />
17+
</ItemGroup>
18+
19+
<ItemGroup>
20+
<Using Include="Microsoft.VisualStudio.TestTools.UnitTesting" />
21+
</ItemGroup>
22+
23+
</Project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
[assembly: Parallelize(Scope = ExecutionScope.MethodLevel)]
+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
namespace Compressonator.NET.Tests;
2+
3+
[TestClass]
4+
public sealed class NativeTests
5+
{
6+
[TestMethod]
7+
public void TestSDKNative()
8+
{
9+
Assert.IsTrue(SDK_NativeMethods.IsSupported, "SDK Native methods should be supported");
10+
}
11+
12+
[TestMethod]
13+
public void TestFrameworkNative()
14+
{
15+
Assert.IsTrue(FrameworkNativeMethods.IsSupported, "Framework Native Methods should be supported.");
16+
}
17+
}

Compressonator.NET.sln

+6
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Compressonator.NET", "Compr
77
EndProject
88
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Compressonator.NET.Samples", "Compressonator.NET.Samples\Compressonator.NET.Samples.csproj", "{A6A2F93F-7A66-4792-A4C2-2913C7071B24}"
99
EndProject
10+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Compressonator.NET.Tests", "Compressonator.NET.Tests\Compressonator.NET.Tests.csproj", "{5C813410-F2AB-4948-909A-463E308E4D23}"
11+
EndProject
1012
Global
1113
GlobalSection(SolutionConfigurationPlatforms) = preSolution
1214
Debug|Any CPU = Debug|Any CPU
@@ -21,6 +23,10 @@ Global
2123
{A6A2F93F-7A66-4792-A4C2-2913C7071B24}.Debug|Any CPU.Build.0 = Debug|Any CPU
2224
{A6A2F93F-7A66-4792-A4C2-2913C7071B24}.Release|Any CPU.ActiveCfg = Release|Any CPU
2325
{A6A2F93F-7A66-4792-A4C2-2913C7071B24}.Release|Any CPU.Build.0 = Release|Any CPU
26+
{5C813410-F2AB-4948-909A-463E308E4D23}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
27+
{5C813410-F2AB-4948-909A-463E308E4D23}.Debug|Any CPU.Build.0 = Debug|Any CPU
28+
{5C813410-F2AB-4948-909A-463E308E4D23}.Release|Any CPU.ActiveCfg = Release|Any CPU
29+
{5C813410-F2AB-4948-909A-463E308E4D23}.Release|Any CPU.Build.0 = Release|Any CPU
2430
EndGlobalSection
2531
GlobalSection(SolutionProperties) = preSolution
2632
HideSolutionNode = FALSE

Compressonator.NET/Compressonator.NET.csproj

+3-6
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,6 @@
2121
<TargetFramework>netstandard2.0</TargetFramework>
2222
<RuntimeIdentifiers>win-x64;linux-x64</RuntimeIdentifiers>
2323
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
24-
25-
<!--Default runtime identifier-->
26-
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
2724
</PropertyGroup>
2825

2926
<ItemGroup>
@@ -32,7 +29,7 @@
3229
</ItemGroup>
3330

3431
<!-- WINDOWS -->
35-
<ItemGroup Condition="'$(RuntimeIdentifier)' == 'win-x64'">
32+
<ItemGroup>
3633
<ContentWithTargetPath Include="Native\win-x64\*.dll">
3734
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
3835
<CopyToPublishDirectory>Always</CopyToPublishDirectory>
@@ -41,11 +38,11 @@
4138
</ItemGroup>
4239

4340
<ItemGroup>
44-
<None Include="Native\win-x64\*.dll" Pack="True" PackagePath="runtimes\win-x64\native\"></None>
41+
<None Include="Native\win-x64\*.dll" Pack="True" PackagePath="runtimes\win-x64\native\" ></None>
4542
</ItemGroup>
4643

4744
<!-- LINUX -->
48-
<ItemGroup Condition="'$(RuntimeIdentifier)' == 'linux-x64'">
45+
<ItemGroup>
4946
<ContentWithTargetPath Include="Native\linux-x64\*.so">
5047
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
5148
<CopyToPublishDirectory>Always</CopyToPublishDirectory>
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

0 commit comments

Comments
 (0)