050408357826896841794b441c87c6b9aa40501f
[teamcity/dotNetPackagesSupport.git] / nuget-extensions / nuget-tests / src / NuGetRunnerTest.cs
1 ´╗┐using System;\r
2 using System.IO;\r
3 using NUnit.Framework;\r
4 \r
5 namespace JetBrains.TeamCity.NuGet.Tests\r
6 {\r
7   [TestFixture]\r
8   public class NuGetRunnerTest\r
9   {\r
10     [Test]\r
11     public void TestExcuteNuGet()\r
12     {\r
13       var r = ProcessExecutor.ExecuteProcess(Files.NuGetRunnerExe, Files.NuGetExe, "help");\r
14       Console.Out.WriteLine(r);\r
15 \r
16       Assert.IsTrue(r.ExitCode == 0);\r
17     }\r
18 \r
19     [Test]\r
20     public void TestExcuteNuGet_NuGetFromTemp()\r
21     {\r
22       TempFilesHolder.WithTempDirectory(\r
23         home =>\r
24           {\r
25             var destNuGet = Path.Combine(home, "NuGet.exe");\r
26             File.Copy(Files.NuGetExe, destNuGet);\r
27 \r
28             ProcessExecutor.ExecuteProcess(Files.NuGetRunnerExe, destNuGet, "TeamCity.Ping")\r
29               .Dump()\r
30               .AssertExitedSuccessfully();\r
31           });\r
32     }\r
33 \r
34     [Test]\r
35     public void TestExcuteNuGet_BothInTemp()\r
36     {\r
37       TempFilesHolder.WithTempDirectory(\r
38         home =>\r
39           {\r
40             var destNuGet = Path.Combine(home, "NuGet.exe");\r
41             var destRunner = Path.Combine(home, "TeamCity.NuGetRunner.exe");\r
42             \r
43             File.Copy(Files.NuGetExe, destNuGet);            \r
44             File.Copy(Files.NuGetRunnerExe, destRunner);\r
45             const string ext = "JetBrains.TeamCity.NuGet.ExtendedCommands.dll";\r
46             File.Copy(Path.Combine(Files.NuGetRunnerExe, "../" + ext), Path.Combine(home, ext));\r
47 \r
48             ProcessExecutor.ExecuteProcess(destRunner, destNuGet, "TeamCity.Ping")\r
49               .Dump()\r
50               .AssertExitedSuccessfully();\r
51           });\r
52     }\r
53 \r
54 \r
55     [Test]\r
56     public void TestDumpExtensionsPath()\r
57     {\r
58       var r = ProcessExecutor.ExecuteProcess(Files.NuGetRunnerExe, Files.NuGetExe, "---TeamCity.DumpExtensionsPath");\r
59       Console.Out.WriteLine(r);\r
60 \r
61       Assert.IsTrue(r.ExitCode == 0);\r
62     }\r
63 \r
64     [Test]\r
65     public void TestCommand_TeamCityPing()\r
66     {\r
67       ProcessExecutor.ExecuteProcess(Files.NuGetRunnerExe, Files.NuGetExe, "TeamCity.Ping")\r
68         .Dump()\r
69         .AssertExitedSuccessfully()\r
70         .AssertNoErrorOutput()\r
71         .AssertOutputContains("TeamCity NuGet Extension is available.");\r
72     }\r
73   }\r
74 }\r