Prepare test project for dotnet-remove-p2p
This commit is contained in:
parent
78d95b423e
commit
65f699f1cc
12 changed files with 203 additions and 8 deletions
|
@ -1,4 +1,7 @@
|
|||
using Microsoft.Build.Construction;
|
||||
// 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 Microsoft.Build.Construction;
|
||||
using Microsoft.DotNet.ProjectJsonMigration;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
|
|
@ -115,7 +115,7 @@ namespace Microsoft.DotNet.Tools
|
|||
// Project = /some/path/a/b/p.proj
|
||||
//
|
||||
// We do not know the format of passed reference so
|
||||
// directories to consider for removal are following:
|
||||
// path references to consider for removal are following:
|
||||
// - full path to ref.proj [/some/path/a/d/ref.proj]
|
||||
// - string which is passed as reference is relative to project [../d/ref.proj]
|
||||
// - string which is passed as reference is relative to current dir [../../d/ref.proj]
|
||||
|
|
60
test/Msbuild.Tests.Utilities/Msbuild.Tests.Utilities.csproj
Normal file
60
test/Msbuild.Tests.Utilities/Msbuild.Tests.Utilities.csproj
Normal file
|
@ -0,0 +1,60 @@
|
|||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" />
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netcoreapp1.0</TargetFramework>
|
||||
<GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>
|
||||
<AssemblyName>Msbuild.Tests.Utilities</AssemblyName>
|
||||
<PackageTargetFallback Condition=" '$(TargetFramework)' == 'netcoreapp1.0' ">$(PackageTargetFallback);dotnet5.4;portable-net451+win8</PackageTargetFallback>
|
||||
<DefineConstants>$(DefineConstants);DISABLE_TRACE</DefineConstants>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="**\*.cs" />
|
||||
<Compile Include="..\..\src\Microsoft.DotNet.ProjectJsonMigration\MSBuildExtensions.cs">
|
||||
<Link>src\Microsoft.DotNet.ProjectJsonMigration\MSBuildExtensions.cs</Link>
|
||||
</Compile>
|
||||
<EmbeddedResource Include="**\*.resx" />
|
||||
<EmbeddedResource Include="compiler\resources\**\*" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Microsoft.DotNet.Tools.Tests.Utilities\Microsoft.DotNet.Tools.Tests.Utilities.csproj" />
|
||||
<ProjectReference Include="..\..\src\Microsoft.DotNet.TestFramework\Microsoft.DotNet.TestFramework.csproj">
|
||||
<FromP2P>true</FromP2P>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\src\Microsoft.DotNet.Cli.Utils\Microsoft.DotNet.Cli.Utils.csproj">
|
||||
<FromP2P>true</FromP2P>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\src\Microsoft.DotNet.InternalAbstractions\Microsoft.DotNet.InternalAbstractions.csproj">
|
||||
<FromP2P>true</FromP2P>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup Condition=" '$(TargetFramework)' == 'net46' ">
|
||||
<Reference Include="System.Runtime">
|
||||
<FromP2P>true</FromP2P>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.NET.Sdk">
|
||||
<Version>1.0.0-alpha-20161104-2</Version>
|
||||
<PrivateAssets>All</PrivateAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="NETStandard.Library">
|
||||
<Version>1.6.0</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="System.Runtime.Serialization.Primitives">
|
||||
<Version>4.1.1</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="FluentAssertions">
|
||||
<Version>4.0.0</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="xunit">
|
||||
<Version>2.2.0-beta4-build3444</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.Build">
|
||||
<Version>15.1.0-preview-000370-00</Version>
|
||||
</PackageReference>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
|
||||
<DefineConstants>$(DefineConstants);RELEASE</DefineConstants>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
|
@ -5,9 +5,9 @@ using System.IO;
|
|||
using Microsoft.Build.Construction;
|
||||
using Microsoft.Build.Evaluation;
|
||||
|
||||
namespace Microsoft.DotNet.Cli.Add.P2P.Tests
|
||||
namespace Msbuild.Tests.Utilities
|
||||
{
|
||||
internal class ProjDir
|
||||
public class ProjDir
|
||||
{
|
||||
public ProjDir(string path)
|
||||
{
|
|
@ -6,9 +6,9 @@ using Microsoft.DotNet.ProjectJsonMigration;
|
|||
using System.Linq;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Microsoft.DotNet.Cli.Add.P2P.Tests
|
||||
namespace Msbuild.Tests.Utilities
|
||||
{
|
||||
internal static class ProjectRootElementExtensions
|
||||
public static class ProjectRootElementExtensions
|
||||
{
|
||||
public static int NumberOfItemGroupsWithConditionContaining(
|
||||
this ProjectRootElement root,
|
|
@ -3,9 +3,9 @@
|
|||
|
||||
using System.IO;
|
||||
|
||||
namespace Microsoft.DotNet.Cli.Add.P2P.Tests
|
||||
namespace Msbuild.Tests.Utilities
|
||||
{
|
||||
internal class TestSetup
|
||||
public class TestSetup
|
||||
{
|
||||
public const string TestGroup = "NonRestoredTestProjects";
|
||||
public const string ProjectName = "DotnetAddP2PProjects";
|
|
@ -4,6 +4,7 @@
|
|||
using FluentAssertions;
|
||||
using Microsoft.Build.Construction;
|
||||
using Microsoft.DotNet.Tools.Test.Utilities;
|
||||
using Msbuild.Tests.Utilities;
|
||||
using System;
|
||||
using System.IO;
|
||||
using Xunit;
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
<ProjectReference Include="..\..\src\Microsoft.DotNet.InternalAbstractions\Microsoft.DotNet.InternalAbstractions.csproj">
|
||||
<FromP2P>true</FromP2P>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Msbuild.Tests.Utilities\Msbuild.Tests.Utilities.csproj" />
|
||||
</ItemGroup>
|
||||
<ItemGroup Condition=" '$(TargetFramework)' == 'net46' ">
|
||||
<Reference Include="System.Runtime">
|
||||
|
|
61
test/dotnet-remove-p2p.Tests/GivenDotnetRemoveP2P.cs
Normal file
61
test/dotnet-remove-p2p.Tests/GivenDotnetRemoveP2P.cs
Normal file
|
@ -0,0 +1,61 @@
|
|||
// 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.Build.Construction;
|
||||
using Microsoft.DotNet.Tools.Test.Utilities;
|
||||
using Msbuild.Tests.Utilities;
|
||||
using System;
|
||||
using System.IO;
|
||||
using Xunit;
|
||||
|
||||
namespace Microsoft.DotNet.Cli.Remove.P2P.Tests
|
||||
{
|
||||
public class GivenDotnetRemoveP2P : TestBase
|
||||
{
|
||||
const string FrameworkNet451Arg = "-f net451";
|
||||
const string ConditionFrameworkNet451 = "== 'net451'";
|
||||
const string FrameworkNetCoreApp10Arg = "-f netcoreapp1.0";
|
||||
const string ConditionFrameworkNetCoreApp10 = "== 'netcoreapp1.0'";
|
||||
|
||||
private TestSetup Setup([System.Runtime.CompilerServices.CallerMemberName] string callingMethod = nameof(Setup), string identifier = "")
|
||||
{
|
||||
return new TestSetup(
|
||||
TestAssets.Get(TestSetup.TestGroup, TestSetup.ProjectName)
|
||||
.CreateInstance(callingMethod: callingMethod, identifier: identifier)
|
||||
.WithSourceFiles()
|
||||
.Root
|
||||
.FullName);
|
||||
}
|
||||
|
||||
private ProjDir NewDir([System.Runtime.CompilerServices.CallerMemberName] string callingMethod = nameof(NewDir), string identifier = "")
|
||||
{
|
||||
return new ProjDir(TestAssetsManager.CreateTestDirectory(callingMethod: callingMethod, identifier: identifier).Path);
|
||||
}
|
||||
|
||||
private ProjDir NewLib([System.Runtime.CompilerServices.CallerMemberName] string callingMethod = nameof(NewDir), string identifier = "")
|
||||
{
|
||||
var dir = NewDir(callingMethod: callingMethod, identifier: identifier);
|
||||
|
||||
try
|
||||
{
|
||||
new NewCommand()
|
||||
.WithWorkingDirectory(dir.Path)
|
||||
.ExecuteWithCapturedOutput("-t Lib")
|
||||
.Should().Pass();
|
||||
}
|
||||
catch (System.ComponentModel.Win32Exception e)
|
||||
{
|
||||
throw new Exception($"Intermittent error in `dotnet new` occurred when running it in dir `{dir.Path}`\nException:\n{e}");
|
||||
}
|
||||
|
||||
return dir;
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void FinishMe()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
1
test/dotnet-remove-p2p.Tests/MSBuild.exe
Normal file
1
test/dotnet-remove-p2p.Tests/MSBuild.exe
Normal file
|
@ -0,0 +1 @@
|
|||
https://github.com/Microsoft/msbuild/issues/927
|
1
test/dotnet-remove-p2p.Tests/MSBuild.exe.config
Normal file
1
test/dotnet-remove-p2p.Tests/MSBuild.exe.config
Normal file
|
@ -0,0 +1 @@
|
|||
https://github.com/Microsoft/msbuild/issues/927
|
67
test/dotnet-remove-p2p.Tests/dotnet-remove-p2p.Tests.csproj
Normal file
67
test/dotnet-remove-p2p.Tests/dotnet-remove-p2p.Tests.csproj
Normal file
|
@ -0,0 +1,67 @@
|
|||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" />
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netcoreapp1.0</TargetFramework>
|
||||
<GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>
|
||||
<AssemblyName>dotnet-remove-p2p.Tests</AssemblyName>
|
||||
<PackageTargetFallback Condition=" '$(TargetFramework)' == 'netcoreapp1.0' ">$(PackageTargetFallback);dotnet5.4;portable-net451+win8</PackageTargetFallback>
|
||||
<DefineConstants>$(DefineConstants);DISABLE_TRACE</DefineConstants>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="**\*.cs" />
|
||||
<Compile Include="..\..\src\Microsoft.DotNet.ProjectJsonMigration\MSBuildExtensions.cs">
|
||||
<Link>src\Microsoft.DotNet.ProjectJsonMigration\MSBuildExtensions.cs</Link>
|
||||
</Compile>
|
||||
<EmbeddedResource Include="**\*.resx" />
|
||||
<EmbeddedResource Include="compiler\resources\**\*" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Microsoft.DotNet.Tools.Tests.Utilities\Microsoft.DotNet.Tools.Tests.Utilities.csproj" />
|
||||
<ProjectReference Include="..\..\src\Microsoft.DotNet.TestFramework\Microsoft.DotNet.TestFramework.csproj">
|
||||
<FromP2P>true</FromP2P>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\src\Microsoft.DotNet.Cli.Utils\Microsoft.DotNet.Cli.Utils.csproj">
|
||||
<FromP2P>true</FromP2P>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\src\Microsoft.DotNet.InternalAbstractions\Microsoft.DotNet.InternalAbstractions.csproj">
|
||||
<FromP2P>true</FromP2P>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Msbuild.Tests.Utilities\Msbuild.Tests.Utilities.csproj" />
|
||||
</ItemGroup>
|
||||
<ItemGroup Condition=" '$(TargetFramework)' == 'net46' ">
|
||||
<Reference Include="System.Runtime">
|
||||
<FromP2P>true</FromP2P>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.NET.Sdk">
|
||||
<Version>1.0.0-alpha-20161104-2</Version>
|
||||
<PrivateAssets>All</PrivateAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk">
|
||||
<Version>15.0.0-preview-20161024-02</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="xunit.runner.visualstudio">
|
||||
<Version>2.2.0-beta4-build1194</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.NETCore.App">
|
||||
<Version>1.0.1</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="System.Runtime.Serialization.Primitives">
|
||||
<Version>4.1.1</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="xunit">
|
||||
<Version>2.2.0-beta4-build3444</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.Build">
|
||||
<Version>15.1.0-preview-000370-00</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="FluentAssertions">
|
||||
<Version>4.0.0</Version>
|
||||
</PackageReference>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
|
||||
<DefineConstants>$(DefineConstants);RELEASE</DefineConstants>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
Loading…
Add table
Reference in a new issue