support multiple package checks
[teamcity/dotNetPackagesSupport.git] / nuget-extensions / nuget-tests / src / NuGetRunner_ListPackagesCommandTest.cs
1 using System.IO;\r
2 using NUnit.Framework;\r
3 using NuGet;\r
4 \r
5 namespace JetBrains.TeamCity.NuGet.Tests\r
6 {\r
7   [TestFixture]\r
8   public class NuGetRunner_ListPackagesCommandTest\r
9   {\r
10     [Test]\r
11     public void TestCommand_ListPublic()\r
12     {\r
13       TempFilesHolder.WithTempFile(\r
14         file =>\r
15           {\r
16             File.WriteAllText(file,\r
17                               "<NuGet-Request Source=\"" + NuGetConstants.DefaultFeedUrl +\r
18                               "\"><Requests><Request Id='NUnit'/></Requests></NuGet-Request>");\r
19 \r
20             ProcessExecutor.ExecuteProcess(NuGetRunner.Path.Value, NuGet.NuGetPath,\r
21                                            "TeamCity.ListPackages", "-Request", file)\r
22               .Dump()\r
23               .AssertExitedSuccessfully()\r
24               .AssertNoErrorOutput()\r
25               .AssertOutputContains("##teamcity[nuget-package Id='NUnit' Version='2.5.7.10213']")\r
26               .AssertOutputContains("##teamcity[nuget-package Id='NUnit' Version='2.5.10.11092']")\r
27               ;\r
28           });\r
29     }\r
30 \r
31     [Test]\r
32     public void TestCommand_ListPublicVersions()\r
33     {\r
34       TempFilesHolder.WithTempFile(\r
35         file =>\r
36           {\r
37             File.WriteAllText(file,\r
38                               "<NuGet-Request Source=\"" + NuGetConstants.DefaultFeedUrl +\r
39                               "\"><Requests><Request Id='NUnit' Versions='(1.1.1,2.5.8]'/></Requests></NuGet-Request>");\r
40 \r
41             ProcessExecutor.ExecuteProcess(NuGetRunner.Path.Value, NuGet.NuGetPath,\r
42                                            "TeamCity.ListPackages", "-Request", file)\r
43               .Dump()\r
44               .AssertExitedSuccessfully()\r
45               .AssertNoErrorOutput()\r
46               .AssertOutputContains("##teamcity[nuget-package Id='NUnit' Version='2.5.7.10213']")\r
47               ;\r
48           });\r
49     }\r
50 \r
51   }\r
52 }