2 using System.Collections.Generic;
\r
5 using NUnit.Framework;
\r
7 namespace JetBrains.TeamCity.NuGet.Tests
\r
10 [TestFixture("bt4")]
\r
11 [TestFixture("bt22")]
\r
12 [TestFixture("bt21")]
\r
13 public class NuGetRunnerWithTrunk
\r
15 private readonly Lazy<string> home;
\r
17 private readonly Lazy<string> nuget;
\r
19 public NuGetRunnerWithTrunk(string bt)
\r
22 home = new Lazy<string>(() =>
\r
24 var homePath = Path.GetTempFileName();
\r
25 File.Delete(homePath);
\r
26 Directory.CreateDirectory(homePath);
\r
30 nuget = new Lazy<string>(() =>
\r
32 string url = "http://ci.nuget.org:8080/guestAuth/repository/download/" + bt +
\r
33 "/.lastSuccessful/Console/NuGet.exe";
\r
34 var nugetPath = Path.Combine(home.Value, "NuGet.exe");
\r
35 var cli = new WebClient();
\r
36 cli.DownloadFile(url, nugetPath);
\r
43 [TestFixtureTearDown]
\r
44 public void Cleanup()
\r
46 if (home.IsValueCreated)
\r
48 Directory.Delete(home.Value, true);
\r
53 public void Test_Ping()
\r
55 DoTest("TeamCity.Ping");
\r
59 public void Test_List_NUnit_Remote()
\r
61 DoTest("TeamCity.List", "-Id", "NUnit")
\r
62 .AssertOutputContains("##teamcity[nuget-package Id='NUnit' Version='2.5.10.11092']");
\r
66 public void Test_List_NUnit_Local()
\r
68 DoTest("TeamCity.List", "-Id", "Web", "-Source", Files.LocalFeed)
\r
69 .AssertOutputContains("##teamcity[nuget-package Id='Web' Version='1.1.1']");
\r
72 private ProcessExecutor.Result DoTest(params string[] argz)
\r
74 var az = new List<string>();
\r
75 az.Add(nuget.Value);
\r
78 return ProcessExecutor.ExecuteProcess(Files.NuGetRunnerExe, az.ToArray())
\r
80 .AssertExitedSuccessfully();
\r