diff --git a/test/data/test-isn/testcmd b/test/data/test-isn/testcmd new file mode 100644 index 0000000..2127221 --- /dev/null +++ b/test/data/test-isn/testcmd @@ -0,0 +1 @@ +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 bc985ed..1871ebf 100644 --- a/test/isn.tests/PushTest.cs +++ b/test/isn.tests/PushTest.cs @@ -9,6 +9,7 @@ using System.Text; using System.Threading.Tasks; using Newtonsoft.Json; using Xunit; +using isnd.Entities; using Isn.Abstract; namespace Isn.tests @@ -207,7 +208,7 @@ namespace Isn.tests public void TestPush() { Program.LoadConfig(); - var report = Program.PushPkg(new[] { GetDummyPackagePath() }); + var report = Program.PushPkg(new[] { Path.Combine(AppContext.BaseDirectory, "dummy.nupkg") }); Assert.NotNull(report); Assert.Single(report); } @@ -221,7 +222,7 @@ namespace Isn.tests Program.SaveConfig(); Program.LoadConfig(); - var report = Program.PushPkg(new[] { GetDummyPackagePath() }); + var report = Program.PushPkg(new[] { Path.Combine(AppContext.BaseDirectory, "dummy.nupkg") }); Assert.NotNull(report); Assert.Single(report); @@ -237,33 +238,5 @@ 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 e7386e8..c71b5ea 100644 --- a/test/isnd.tests/UnitTestWebHost.cs +++ b/test/isnd.tests/UnitTestWebHost.cs @@ -17,6 +17,7 @@ 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;