From 8045f4c2115b81cd79952c8b5f71ca15b98907bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Fi=C5=A1era?= Date: Thu, 11 Nov 2021 08:02:59 +0100 Subject: [PATCH 1/3] Fix unit tests after #58. - Moving package down in sources collection wasn't working. - Remove --no-build from Run-Tests.ps1, because we don't build whole solution in previous steps. --- .../Models/NuGetPackageSourceCollection.cs | 2 +- tools/Run-Tests.ps1 | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/PackageManager.NuGet/Models/NuGetPackageSourceCollection.cs b/src/PackageManager.NuGet/Models/NuGetPackageSourceCollection.cs index d8b3f00..b7169db 100644 --- a/src/PackageManager.NuGet/Models/NuGetPackageSourceCollection.cs +++ b/src/PackageManager.NuGet/Models/NuGetPackageSourceCollection.cs @@ -107,7 +107,7 @@ public int MoveDown(IPackageSource source) { Sources.RemoveAt(index); Sources.Insert(++index, target); - SavePackageSources(); + SavePackageSources(true); } return index; diff --git a/tools/Run-Tests.ps1 b/tools/Run-Tests.ps1 index 3b13d7e..4babc13 100644 --- a/tools/Run-Tests.ps1 +++ b/tools/Run-Tests.ps1 @@ -1,6 +1,6 @@ Push-Location $PSScriptRoot; -dotnet test ..\test\PackageManager.NuGet.Tests\PackageManager.NuGet.Tests.csproj -c Release --no-build --test-adapter-path:.. --logger:Appveyor /property:Platform=AnyCPU -dotnet test ..\test\PackageManager.Tests\PackageManager.Tests.csproj -c Release --no-build --test-adapter-path:.. --logger:Appveyor /property:Platform=AnyCPU +dotnet test ..\test\PackageManager.NuGet.Tests\PackageManager.NuGet.Tests.csproj -c Release --test-adapter-path:.. --logger:Appveyor /property:Platform=AnyCPU +dotnet test ..\test\PackageManager.Tests\PackageManager.Tests.csproj -c Release --test-adapter-path:.. --logger:Appveyor /property:Platform=AnyCPU Pop-Location; \ No newline at end of file From bc363d64c33831370fa165ba946a22b0b32c6d2e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Fi=C5=A1era?= Date: Thu, 11 Nov 2021 08:11:20 +0100 Subject: [PATCH 2/3] - Use local package extraction path in tests. --- test/PackageManager.Tests/ViewModels/Commands/TestCommands.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/PackageManager.Tests/ViewModels/Commands/TestCommands.cs b/test/PackageManager.Tests/ViewModels/Commands/TestCommands.cs index 1ede0c9..f356c00 100644 --- a/test/PackageManager.Tests/ViewModels/Commands/TestCommands.cs +++ b/test/PackageManager.Tests/ViewModels/Commands/TestCommands.cs @@ -15,7 +15,7 @@ namespace PackageManager.ViewModels.Commands [TestClass] public class TestCommands { - private const string ExtractPath = @"D:\"; + private const string ExtractPath = @".\"; [TestMethod] public void Install() From 6b661791d42d121ae40f528ab6faf0f1e049d790 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Fi=C5=A1era?= Date: Fri, 12 Nov 2021 08:11:57 +0100 Subject: [PATCH 3/3] - Generate binlogs during test run. --- appveyor.yml | 1 + tools/Run-Tests.ps1 | 15 +++++++++++++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index f6253a0..842a0d4 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -51,6 +51,7 @@ test_script: artifacts: - path: .\GitExtensions.PluginManager.*.zip - path: .\GitExtensions.PluginManager.*.nupkg +- path: .\*.binlog #---------------------------------# # deployment configuration # diff --git a/tools/Run-Tests.ps1 b/tools/Run-Tests.ps1 index 4babc13..7a942c5 100644 --- a/tools/Run-Tests.ps1 +++ b/tools/Run-Tests.ps1 @@ -1,6 +1,17 @@ Push-Location $PSScriptRoot; -dotnet test ..\test\PackageManager.NuGet.Tests\PackageManager.NuGet.Tests.csproj -c Release --test-adapter-path:.. --logger:Appveyor /property:Platform=AnyCPU -dotnet test ..\test\PackageManager.Tests\PackageManager.Tests.csproj -c Release --test-adapter-path:.. --logger:Appveyor /property:Platform=AnyCPU +$targetPath = '..\'; + +$isAppveyor = $True -eq $env:APPVEYOR; + +If (!$isAppveyor) +{ + Write-Host "Running locally"; + + $targetPath = Join-Path $targetPath 'artifacts'; +} + +dotnet test ..\test\PackageManager.NuGet.Tests\PackageManager.NuGet.Tests.csproj -c Release --test-adapter-path:.. --logger:Appveyor /property:Platform=AnyCPU -bl:$targetPath\build-PackageManager.NuGet.Tests.binlog +dotnet test ..\test\PackageManager.Tests\PackageManager.Tests.csproj -c Release --test-adapter-path:.. --logger:Appveyor /property:Platform=AnyCPU -bl:$targetPath\build-PackageManager.Tests.binlog Pop-Location; \ No newline at end of file