make tests does not depend from NuGetRunner and NuGet, catch command exceptions,...
[teamcity/dotNetPackagesSupport.git] / nuget-extensions / nuget-tests / src / NuGetRunner_ListCommandTest.cs
1 using NUnit.Framework;\r
2 \r
3 namespace JetBrains.TeamCity.NuGet.Tests\r
4 {\r
5   [TestFixture]\r
6   public class NuGetRunner_ListCommandTest_Remote\r
7   {\r
8     [Test]\r
9     public void TestCommand_TeamListPublic()\r
10     {\r
11       ProcessExecutor.ExecuteProcess(Files.NuGetRunnerExe, Files.NuGetExe, "TeamCity.List", "-Id", "NUnit", "-Source", NuGetConstants.DefaultFeedUrl)\r
12         .Dump()\r
13         .AssertExitedSuccessfully()\r
14         .AssertNoErrorOutput()\r
15         .AssertOutputContains("##teamcity[nuget-package Id='NUnit' Version='2.5.10.11092']");\r
16     }\r
17 \r
18     [Test]\r
19     public void TestCommand_TeamListPublicVersion()\r
20     {\r
21       var r = ProcessExecutor.ExecuteProcess(Files.NuGetRunnerExe, Files.NuGetExe, "TeamCity.List", "-Id", "NUnit", "-Version", "(1.1.1, 2.5.8)", "-Source", NuGetConstants.DefaultFeedUrl)\r
22         .Dump()\r
23         .AssertExitedSuccessfully()\r
24         .AssertNoErrorOutput()\r
25         .AssertOutputContains("##teamcity[nuget-package Id='NUnit' Version='2.5.7.10213']");\r
26 \r
27       Assert.IsFalse(r.Output.Contains("Version='2.5.10"));\r
28     }\r
29   }\r
30 \r
31   [TestFixture]\r
32   public class NuGetRunner_ListCommandTest_Local\r
33   {\r
34     [Test]\r
35     public void TestCommand_TeamListPublic()\r
36     {\r
37       ProcessExecutor.ExecuteProcess(Files.NuGetRunnerExe, Files.NuGetExe, "TeamCity.List", "-Id", "Web", "-Source", Files.LocalFeed)\r
38         .Dump()\r
39         .AssertExitedSuccessfully()\r
40         .AssertNoErrorOutput()\r
41         .AssertOutputContains("##teamcity[nuget-package Id='Web' Version='1.1.1']",\r
42                               "##teamcity[nuget-package Id='Web' Version='1.2.1']",\r
43                               "##teamcity[nuget-package Id='Web' Version='2.2.2']");\r
44     }\r
45 \r
46     [Test]\r
47     public void TestCommand_TeamListPublicVersion()\r
48     {\r
49       var r = ProcessExecutor.ExecuteProcess(Files.NuGetRunnerExe, Files.NuGetExe, "TeamCity.List", "-Id", "Web", "-Version", "(1.2.0, 2.1.8)", "-Source", Files.LocalFeed)\r
50         .Dump()\r
51         .AssertExitedSuccessfully()\r
52         .AssertNoErrorOutput()\r
53         .AssertOutputContains("##teamcity[nuget-package Id='Web' Version='1.2.1']");\r
54 \r
55       Assert.IsFalse(r.Output.Contains("Version='1.1.1"));\r
56       Assert.IsFalse(r.Output.Contains("Version='2.2.2"));\r
57     }\r
58   }\r
59 }