2 using System.Collections.Generic;
\r
5 using NUnit.Framework;
\r
7 namespace JetBrains.TeamCity.NuGet.Tests
\r
10 [TestFixture("bt22")]
\r
11 [TestFixture("bt21")]
\r
12 public class NuGetRunnerWithTrunk
\r
14 private readonly Lazy<string> home;
\r
16 private readonly Lazy<string> nuget;
\r
18 public NuGetRunnerWithTrunk(string bt)
\r
21 home = new Lazy<string>(() =>
\r
23 var homePath = Path.GetTempFileName();
\r
24 File.Delete(homePath);
\r
25 Directory.CreateDirectory(homePath);
\r
29 nuget = new Lazy<string>(() =>
\r
31 string url = "http://ci.nuget.org:8080/guestAuth/repository/download/" + bt +
\r
32 "/.lastSuccessful/Console/NuGet.exe";
\r
33 var nugetPath = Path.Combine(home.Value, "NuGet.exe");
\r
34 var cli = new WebClient();
\r
35 cli.DownloadFile(url, nugetPath);
\r
42 [TestFixtureTearDown]
\r
43 public void Cleanup()
\r
45 if (home.IsValueCreated)
\r
47 Directory.Delete(home.Value, true);
\r
52 public void Test_Ping()
\r
54 DoTest("TeamCity.Ping");
\r
58 public void Test_List_NUnit_Remote()
\r
60 DoTest("TeamCity.List", "-Id", "NUnit")
\r
61 .AssertOutputContains("##teamcity[nuget-package Id='NUnit' Version='2.5.10.11092']");
\r
65 public void Test_List_NUnit_Local()
\r
67 DoTest("TeamCity.List", "-Id", "Web", "-Source", Files.LocalFeed)
\r
68 .AssertOutputContains("##teamcity[nuget-package Id='Web' Version='1.1.1']");
\r
71 private ProcessExecutor.Result DoTest(params string[] argz)
\r
73 var az = new List<string>();
\r
74 az.Add(nuget.Value);
\r
77 return ProcessExecutor.ExecuteProcess(Files.NuGetRunnerExe, az.ToArray())
\r
79 .AssertExitedSuccessfully();
\r