diff --git a/test/data/test-isn/testcmd b/test/data/test-isn/testcmd deleted file mode 100644 index 2127221..0000000 --- a/test/data/test-isn/testcmd +++ /dev/null @@ -1 +0,0 @@ -nuget install -NoCache -Verbosity detailed -ConfigFile ANuGet.Config Yavsc.Abstract diff --git a/test/isn.tests/PushTest.cs b/test/isn.tests/PushTest.cs index 1871ebf..bc985ed 100644 --- a/test/isn.tests/PushTest.cs +++ b/test/isn.tests/PushTest.cs @@ -9,7 +9,6 @@ using System.Text; using System.Threading.Tasks; using Newtonsoft.Json; using Xunit; -using isnd.Entities; using Isn.Abstract; namespace Isn.tests @@ -208,7 +207,7 @@ namespace Isn.tests public void TestPush() { Program.LoadConfig(); - var report = Program.PushPkg(new[] { Path.Combine(AppContext.BaseDirectory, "dummy.nupkg") }); + var report = Program.PushPkg(new[] { GetDummyPackagePath() }); Assert.NotNull(report); Assert.Single(report); } @@ -222,7 +221,7 @@ namespace Isn.tests Program.SaveConfig(); Program.LoadConfig(); - var report = Program.PushPkg(new[] { Path.Combine(AppContext.BaseDirectory, "dummy.nupkg") }); + var report = Program.PushPkg(new[] { GetDummyPackagePath() }); Assert.NotNull(report); Assert.Single(report); @@ -238,5 +237,33 @@ namespace Isn.tests var pub = model.Resources.FirstOrDefault(r => r.Type.StartsWith("PackagePublish/")); Assert.True(pub != null); } + + private static string GetDummyPackagePath() + { + var localOutputDummy = Path.Combine(AppContext.BaseDirectory, "dummy.nupkg"); + if (File.Exists(localOutputDummy)) + { + return localOutputDummy; + } + + var dir = new DirectoryInfo(AppContext.BaseDirectory); + while (dir != null) + { + if (File.Exists(Path.Combine(dir.FullName, "isn.sln"))) + { + var sharedArtifact = Path.Combine(dir.FullName, "test", "data", "nuget-artifacts", "dummy.nuget.1.0.0.nupkg"); + if (File.Exists(sharedArtifact)) + { + return sharedArtifact; + } + + break; + } + + dir = dir.Parent; + } + + throw new FileNotFoundException("Unable to locate a dummy NuGet package for push tests."); + } } } \ No newline at end of file diff --git a/test/isnd.tests/UnitTestWebHost.cs b/test/isnd.tests/UnitTestWebHost.cs index c71b5ea..e7386e8 100644 --- a/test/isnd.tests/UnitTestWebHost.cs +++ b/test/isnd.tests/UnitTestWebHost.cs @@ -17,7 +17,6 @@ using Microsoft.AspNetCore.DataProtection; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Options; -using NuGet.Common; using NuGet.Configuration; using NuGet.Protocol; using NuGet.Protocol.Core.Types;