02a98d4e63
* Integrate NuGet ask * Update NuGet version. Rely on NuGet to filter TFM. And use asset.json to find entrypoint * Update XML file to per TFM * Add extra property to the fake project according to nuget * Treat nuget fallback folder as offline cache for tool * Require -g to install global tool * Copy test asset during test project build * Address code review on LockFileMatchChecker * Get NETCorePlatformsImplicitPackageVersion from PackageDefinitions * Edit and add missing loc * Change LockFileMatchChecker to local function * Adding comment * Add to content instead of copy * Download platform package instead * disable SDK side implicit NuGetFallbackFolder * merge loc * Revert extra line * use a prerelease platforms version that supports alpine
28 lines
1.3 KiB
C#
28 lines
1.3 KiB
C#
// Copyright (c) .NET Foundation and contributors. All rights reserved.
|
|
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
|
|
using FluentAssertions;
|
|
using Microsoft.DotNet.Tools.Test.Utilities;
|
|
using NuGet.ProjectModel;
|
|
using Xunit;
|
|
|
|
namespace Microsoft.DotNet.ToolPackage.Tests
|
|
{
|
|
public class LockFileMatcherTests : TestBase
|
|
{
|
|
|
|
[Theory]
|
|
[InlineData("tools/netcoreapp1.1/any/tool.dll", "tool.dll", true)]
|
|
[InlineData(@"tools\netcoreapp1.1\any\subDirectory\tool.dll", "subDirectory/tool.dll", true)]
|
|
[InlineData("tools/netcoreapp1.1/win-x64/tool.dll", "tool.dll", true)]
|
|
[InlineData("tools/netcoreapp1.1/any/subDirectory/tool.dll", "subDirectory/tool.dll", true)]
|
|
[InlineData("libs/netcoreapp1.1/any/tool.dll", "tool.dll", false)]
|
|
[InlineData("tools/netcoreapp1.1/any/subDirectory/tool.dll", "tool.dll", false)]
|
|
[InlineData("tools/netcoreapp1.1/any/subDirectory/tool.dll", "subDirectory/subDirectory/subDirectory/subDirectory/subDirectory/tool.dll", false)]
|
|
public void MatchesEntryPointTests(string pathInLockFileItem, string targetRelativeFilePath, bool shouldMatch)
|
|
{
|
|
LockFileMatcher.MatchesFile(new LockFileItem(pathInLockFileItem), targetRelativeFilePath)
|
|
.Should().Be(shouldMatch);
|
|
}
|
|
}
|
|
}
|