public void TestMstestAdapter_Path()
        {
            var preprocessor = new NuGetPreprocessorExtension();
            var result       = preprocessor.EvaluateFunction("nuget", "GetPath", new[] { "Mstest.TestAdapter" });

            Assert.AreEqual(Path.Combine(NuGetLogic.GetNuGetCacheDir(), "MSTest.TestAdapter", mstestVersion).ToLowerInvariant(), result.ToLowerInvariant());
        }
Пример #2
0
        public void TestGetPathPackagesConfig_CacheFallback()
        {
            using (var tempDir = TempDir.Create())
            {
                File.WriteAllText(Path.Combine(tempDir, "packages.config"), $@"<?xml version=""1.0"" encoding=""utf-8""?>
<packages>
  <package id=""Microsoft.CodeDom.Providers.DotNetCompilerPlatform"" version=""1.0.0"" targetFramework=""net46"" />
  <package id=""Microsoft.Net.Compilers"" version=""1.0.0"" targetFramework=""net46"" developmentDependency=""true"" />
  <package id=""Microsoft.Web.Infrastructure"" version=""1.0.0.0"" targetFramework=""net46"" />
  <package id=""Microsoft.Web.Xdt"" version=""2.1.1"" targetFramework=""net46"" />
  <package id=""Newtonsoft.Json"" version=""8.0.3"" allowedVersions=""[8,10)"" targetFramework=""net46"" />
  <package id=""NuGet.Core"" version=""2.11.1"" targetFramework=""net46"" />
  <package id=""NuGet.Server"" version=""2.11.2"" targetFramework=""net46"" />
  <package id=""RouteMagic"" version=""1.3"" targetFramework=""net46"" />
  <package id=""MSTest.TestAdapter"" version=""{PreprocessorTests.mstestVersion}"" targetFramework=""net46"" />
</packages>");
                var result = NuGetLogic.GetPackagePath(tempDir, "packages", "MSTest.TestAdapter");
                Assert.AreEqual(Path.Combine(NuGetLogic.GetNuGetCacheDir(), "MSTest.TestAdapter", PreprocessorTests.mstestVersion).ToLowerInvariant(), result.ToLowerInvariant());
            }
        }