Skip to content

Commit 5edca6c

Browse files
committed
CSHARP-3063: Modify build.cake to support running tests for just one selected target framework.
1 parent 4b2a63a commit 5edca6c

File tree

1 file changed

+19
-7
lines changed

1 file changed

+19
-7
lines changed

build.cake

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -126,22 +126,34 @@ Task("Test")
126126
Console.WriteLine($"TEST_WITH_DEFAULT_GUID_REPRESENTATION={testWithDefaultGuidRepresentation}");
127127
}
128128

129+
var settings = new DotNetCoreTestSettings
130+
{
131+
NoBuild = true,
132+
NoRestore = true,
133+
Configuration = configuration,
134+
ArgumentCustomization = args => args.Append("-- RunConfiguration.TargetPlatform=x64")
135+
};
136+
switch (target.ToLowerInvariant())
137+
{
138+
case "testnet452": settings.Framework = "net452"; break;
139+
case "testnetstandard15": settings.Framework = "netcoreapp1.1"; break;
140+
case "testnetstandard20": settings.Framework = "netcoreapp2.1"; break;
141+
}
129142
DotNetCoreTest(
130143
testProject.FullPath,
131-
new DotNetCoreTestSettings {
132-
NoBuild = true,
133-
NoRestore = true,
134-
Configuration = configuration,
135-
ArgumentCustomization = args => args.Append("-- RunConfiguration.TargetPlatform=x64")
136-
}
144+
settings
137145
);
138146
});
139147

148+
Task("TestNet452").IsDependentOn("Test");
149+
Task("TestNetStandard15").IsDependentOn("Test");
150+
Task("TestNetStandard20").IsDependentOn("Test");
151+
140152
Task("TestAwsAuthentication")
141153
.IsDependentOn("Build")
142154
.DoesForEach(
143155
GetFiles("./**/MongoDB.Driver.Tests.csproj"),
144-
testProject =>
156+
testProject =>
145157
{
146158
DotNetCoreTest(
147159
testProject.FullPath,

0 commit comments

Comments
 (0)