diff --git a/.github/workflows/internal-pr-build-linux.yml b/.github/workflows/internal-pr-build-linux.yml index d2b249a..96df3ce 100644 --- a/.github/workflows/internal-pr-build-linux.yml +++ b/.github/workflows/internal-pr-build-linux.yml @@ -7,7 +7,7 @@ on: branches: [ "main" ] jobs: - build: + build-and-test: runs-on: ubuntu-latest steps: @@ -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: | diff --git a/CodeQLToolkit.sln b/CodeQLToolkit.sln index 678390f..54867ee 100644 --- a/CodeQLToolkit.sln +++ b/CodeQLToolkit.sln @@ -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 @@ -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 @@ -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 @@ -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} diff --git a/test/CodeQLToolkit.Shared.Tests/CodeQLToolkit.Shared.Tests.csproj b/test/CodeQLToolkit.Shared.Tests/CodeQLToolkit.Shared.Tests.csproj new file mode 100644 index 0000000..78d644e --- /dev/null +++ b/test/CodeQLToolkit.Shared.Tests/CodeQLToolkit.Shared.Tests.csproj @@ -0,0 +1,23 @@ + + + + net6.0 + enable + enable + + false + + + + + + + + + + + + + + + diff --git a/test/CodeQLToolkit.Shared.Tests/UnitTest1.cs b/test/CodeQLToolkit.Shared.Tests/UnitTest1.cs new file mode 100644 index 0000000..cf0d62d --- /dev/null +++ b/test/CodeQLToolkit.Shared.Tests/UnitTest1.cs @@ -0,0 +1,16 @@ +namespace CodeQLToolkit.Shared.Tests +{ + public class Tests + { + [SetUp] + public void Setup() + { + } + + [Test] + public void Test1() + { + Assert.Pass(); + } + } +} \ No newline at end of file diff --git a/test/CodeQLToolkit.Shared.Tests/Usings.cs b/test/CodeQLToolkit.Shared.Tests/Usings.cs new file mode 100644 index 0000000..e7b1313 --- /dev/null +++ b/test/CodeQLToolkit.Shared.Tests/Usings.cs @@ -0,0 +1,2 @@ +global using NUnit.Framework; +global using CodeQLToolkit.Shared.Utils; \ No newline at end of file diff --git a/test/CodeQLToolkit.Shared.Tests/Utils/FileUtilsTest.cs b/test/CodeQLToolkit.Shared.Tests/Utils/FileUtilsTest.cs new file mode 100644 index 0000000..71d70c7 --- /dev/null +++ b/test/CodeQLToolkit.Shared.Tests/Utils/FileUtilsTest.cs @@ -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())); + + } + } +}