Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adding test coverage back #12

Merged
merged 4 commits into from
Jan 16, 2024
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
7 changes: 3 additions & 4 deletions .github/workflows/internal-pr-build-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
branches: [ "main" ]

jobs:
build:
build-and-test:
runs-on: ubuntu-latest

steps:
Expand All @@ -22,10 +22,9 @@ jobs:
run: dotnet restore
- name: Build
run: dotnet build -c Release --no-restore
# - name: Test
# run: dotnet test --no-build --verbosity normal
- name: Test
run: dotnet test -c Release

# create archive in \src\CodeQLToolkit.Core\bin\Release\net6.0\publish\linux-x64
- name: Create Build Bundle (Linux)
shell: pwsh
run: |
Expand Down
11 changes: 9 additions & 2 deletions CodeQLToolkit.sln
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ VisualStudioVersion = 17.6.33801.468
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{667B480C-D805-4A9C-AC1F-D9FCCF3DB57C}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{05645E0E-835A-4627-BDAE-C27EC39B23EE}"
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{05645E0E-835A-4627-BDAE-C27EC39B23EE}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "docs", "docs", "{3038EA53-8F37-4B35-AA50-FDFDDFF0F264}"
ProjectSection(SolutionItems) = preProject
Expand All @@ -25,7 +25,9 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
.github\workflows\release-build.yml = .github\workflows\release-build.yml
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CodeQLToolkit.Features", "src\CodeQLToolkit.Features\CodeQLToolkit.Features.csproj", "{B85F1529-3321-4AD2-924A-6EA478145DC5}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CodeQLToolkit.Features", "src\CodeQLToolkit.Features\CodeQLToolkit.Features.csproj", "{B85F1529-3321-4AD2-924A-6EA478145DC5}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CodeQLToolkit.Shared.Tests", "test\CodeQLToolkit.Shared.Tests\CodeQLToolkit.Shared.Tests.csproj", "{E57121C2-2A2E-487C-9C32-A7D8914E9123}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand All @@ -49,6 +51,10 @@ Global
{B85F1529-3321-4AD2-924A-6EA478145DC5}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B85F1529-3321-4AD2-924A-6EA478145DC5}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B85F1529-3321-4AD2-924A-6EA478145DC5}.Release|Any CPU.Build.0 = Release|Any CPU
{E57121C2-2A2E-487C-9C32-A7D8914E9123}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E57121C2-2A2E-487C-9C32-A7D8914E9123}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E57121C2-2A2E-487C-9C32-A7D8914E9123}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E57121C2-2A2E-487C-9C32-A7D8914E9123}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand All @@ -58,6 +64,7 @@ Global
{4C5C87E8-46E8-41D3-9CF9-F77148C432AF} = {667B480C-D805-4A9C-AC1F-D9FCCF3DB57C}
{A1F78CBC-9AE9-4360-A06B-395F368B183A} = {05645E0E-835A-4627-BDAE-C27EC39B23EE}
{B85F1529-3321-4AD2-924A-6EA478145DC5} = {667B480C-D805-4A9C-AC1F-D9FCCF3DB57C}
{E57121C2-2A2E-487C-9C32-A7D8914E9123} = {05645E0E-835A-4627-BDAE-C27EC39B23EE}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {BF8F3B81-F4DC-4608-A41C-F00F3E5A05CA}
Expand Down
23 changes: 23 additions & 0 deletions test/CodeQLToolkit.Shared.Tests/CodeQLToolkit.Shared.Tests.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>

<IsPackable>false</IsPackable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.1.0" />
<PackageReference Include="NUnit" Version="3.13.3" />
<PackageReference Include="NUnit3TestAdapter" Version="4.2.1" />
<PackageReference Include="NUnit.Analyzers" Version="3.3.0" />
<PackageReference Include="coverlet.collector" Version="3.1.2" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\src\CodeQLToolkit.Shared\CodeQLToolkit.Shared.csproj" />
</ItemGroup>

</Project>
16 changes: 16 additions & 0 deletions test/CodeQLToolkit.Shared.Tests/UnitTest1.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
namespace CodeQLToolkit.Shared.Tests
{
public class Tests
{
[SetUp]
public void Setup()
{
}

[Test]
public void Test1()
{
Assert.Pass();
}
}
}
2 changes: 2 additions & 0 deletions test/CodeQLToolkit.Shared.Tests/Usings.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
global using NUnit.Framework;
global using CodeQLToolkit.Shared.Utils;
33 changes: 33 additions & 0 deletions test/CodeQLToolkit.Shared.Tests/Utils/FileUtilsTest.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace CodeQLToolkit.Shared.Tests.Utils
{
public class FileUtilsTest
{
[SetUp]
public void Setup()
{
}

[Test]
public void TestCreateTempDirectory()
{
var dir = FileUtils.CreateTempDirectory();
Assert.IsTrue(Directory.Exists(dir));
Assert.IsTrue(dir.StartsWith(Path.GetTempPath()));
}

[Test]
public void TestCreateTempDirectoryWithPath()
{
var dir = FileUtils.CreateTempDirectory(Path.GetTempPath());
Assert.IsTrue(Directory.Exists(dir));
Assert.IsTrue(dir.StartsWith(Path.GetTempPath()));

}
}
}
Loading