Add unit test for duplicate system references
This commit is contained in:
parent
c42c60c56b
commit
6a678a0d05
5 changed files with 50 additions and 7 deletions
|
@ -8,7 +8,7 @@
|
|||
"NETStandard.Library": "1.5.0-rc2-24008"
|
||||
}
|
||||
},
|
||||
"dnx451": {
|
||||
"net451": {
|
||||
"dependencies": {
|
||||
"Microsoft.CSharp": "4.0.1-rc2-24008"
|
||||
}
|
||||
|
|
11
TestAssets/TestProjects/TestMscorlibReference/project.json
Normal file
11
TestAssets/TestProjects/TestMscorlibReference/project.json
Normal file
|
@ -0,0 +1,11 @@
|
|||
{
|
||||
"version": "1.0.0-*",
|
||||
"dependencies": {},
|
||||
"frameworks": {
|
||||
"net451": {
|
||||
"frameworkAssemblies": {
|
||||
"mscorlib": ""
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
11
TestAssets/TestProjects/TestSystemCoreReference/project.json
Normal file
11
TestAssets/TestProjects/TestSystemCoreReference/project.json
Normal file
|
@ -0,0 +1,11 @@
|
|||
{
|
||||
"version": "1.0.0-*",
|
||||
"dependencies": {},
|
||||
"frameworks": {
|
||||
"net451": {
|
||||
"frameworkAssemblies": {
|
||||
"System": ""
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
11
TestAssets/TestProjects/TestSystemReference/project.json
Normal file
11
TestAssets/TestProjects/TestSystemReference/project.json
Normal file
|
@ -0,0 +1,11 @@
|
|||
{
|
||||
"version": "1.0.0-*",
|
||||
"dependencies": {},
|
||||
"frameworks": {
|
||||
"net451": {
|
||||
"frameworkAssemblies": {
|
||||
"System.Core": ""
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -42,15 +42,25 @@ namespace Microsoft.DotNet.ProjectModel.Tests
|
|||
Assert.Empty(p2.RuntimeAssemblies);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void SingleMicrosoftCSharpReference()
|
||||
[Theory]
|
||||
[InlineDataAttribute("TestMscorlibReference", true)]
|
||||
[InlineDataAttribute("TestMscorlibReference", false)]
|
||||
[InlineDataAttribute("TestMicrosoftCSharpReference", true)]
|
||||
[InlineDataAttribute("TestMicrosoftCSharpReference", false)]
|
||||
[InlineDataAttribute("TestSystemReference", true)]
|
||||
[InlineDataAttribute("TestSystemReference", false)]
|
||||
[InlineDataAttribute("TestSystemCoreReference", true)]
|
||||
[InlineDataAttribute("TestSystemCoreReference", false)]
|
||||
public void TestDuplicateDefaultDesktopReferences(string sampleName, bool withLockFile)
|
||||
{
|
||||
// https://github.com/dotnet/cli/issues/1602
|
||||
var instance = TestAssetsManager.CreateTestInstance("TestMicrosoftCSharpReference")
|
||||
.WithLockFiles();
|
||||
var instance = TestAssetsManager.CreateTestInstance(sampleName);
|
||||
if (withLockFile)
|
||||
{
|
||||
instance = instance.WithLockFiles();
|
||||
}
|
||||
|
||||
var context = new ProjectContextBuilder().WithProjectDirectory(instance.TestRoot)
|
||||
.WithTargetFramework("dnx451")
|
||||
.WithTargetFramework("net451")
|
||||
.Build();
|
||||
|
||||
Assert.Equal(4, context.RootProject.Dependencies.Count());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue