add more tests on native part
[teamcity/dotNetPackagesSupport.git] / nuget-extensions / nuget-tests / src / NuGet.cs
1 using System;\r
2 using System.IO;\r
3 \r
4 namespace JetBrains.TeamCity.NuGet.Tests\r
5 {\r
6   public static class NuGet\r
7   {\r
8     private static string ourCachedNuGetExe = null;\r
9     public static string NuGetPath\r
10     {\r
11       get\r
12       {\r
13         if (ourCachedNuGetExe != null) return ourCachedNuGetExe;\r
14 \r
15         string path = typeof(NuGetRunnerTest).Assembly.GetAssemblyDirectory();\r
16 \r
17         do\r
18         {\r
19           foreach (var probe in new[] { "nuget.exe", "lib/nuget/1.4/nuget.exe" })\r
20           {\r
21             string nuget = Path.Combine(path, probe);\r
22             if (File.Exists(nuget))\r
23               return ourCachedNuGetExe = nuget;\r
24           }\r
25 \r
26           path = Path.GetDirectoryName(path);\r
27         } while (path != null);\r
28         throw new Exception("Failed to find NuGet.exe near project");\r
29       }\r
30 \r
31     }\r
32 \r
33   }\r
34 }