diff --git a/test/isn.tests/PushTest.cs b/test/isn.tests/PushTest.cs index 1871ebf..10afadc 100644 --- a/test/isn.tests/PushTest.cs +++ b/test/isn.tests/PushTest.cs @@ -208,7 +208,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 +222,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 +238,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