-
Notifications
You must be signed in to change notification settings - Fork 1.1k
/
Copy pathGivenThatWeWantToBuildACppCliProjectWithTransitiveDeps.cs
63 lines (55 loc) · 2.54 KB
/
GivenThatWeWantToBuildACppCliProjectWithTransitiveDeps.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
namespace Microsoft.NET.Build.Tests
{
public class GivenThatWeWantToBuildACppCliProjectWithTransitiveDeps : SdkTest
{
public GivenThatWeWantToBuildACppCliProjectWithTransitiveDeps(ITestOutputHelper log) : base(log)
{
_buildAsset = new Lazy<TestAsset>(BuildAsset);
}
private readonly Lazy<TestAsset> _buildAsset;
[FullMSBuildOnlyFact]
public void It_can_generate_correct_depsJson_file()
{
TestAsset testAsset = _buildAsset.Value;
string depsJsonContent = File.ReadAllText(Path.Combine(testAsset.TestRoot, "NETCoreCppCliTest", "Debug",
"NETCoreCppCliTest.deps.json"));
depsJsonContent.Should().Contain("NETCoreCppCliTestB.dll", "should contain direct project reference");
depsJsonContent.Should().Contain("NETCoreCppCliTestC.dll", "should contain transitive reference");
}
[FullMSBuildOnlyFact]
public void It_can_generate_all_runtimeconfig_files_to_output_folder()
{
TestAsset testAsset = _buildAsset.Value;
var outputDirectory = new DirectoryInfo(Path.Combine(testAsset.TestRoot, "NETCoreCppCliTest", "Debug"));
outputDirectory.Should().HaveFiles(new[]
{
"NETCoreCppCliTest.runtimeconfig.json", "NETCoreCppCliTestB.runtimeconfig.json",
"NETCoreCppCliTestC.runtimeconfig.json"
});
}
[FullMSBuildOnlyFact]
public void It_can_generate_all_depsjson_files_to_output_folder()
{
TestAsset testAsset = _buildAsset.Value;
var outputDirectory = new DirectoryInfo(Path.Combine(testAsset.TestRoot, "NETCoreCppCliTest", "Debug"));
outputDirectory.Should().HaveFiles(new[]
{
"NETCoreCppCliTest.deps.json", "NETCoreCppCliTestB.deps.json", "NETCoreCppCliTestC.deps.json"
});
}
private TestAsset BuildAsset()
{
var testAsset = _testAssetsManager
.CopyTestAsset("NetCoreCppCliLibWithTransitiveDeps")
.WithSource();
// build projects separately with BuildProjectReferences=false to simulate VS build behavior
new BuildCommand(testAsset, "NETCoreCppCliTest")
.Execute("-p:Platform=win32")
.Should()
.Pass();
return testAsset;
}
}
}