-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.cake
63 lines (53 loc) · 1.76 KB
/
build.cake
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
#addin "Cake.FileHelpers&version=5.0.0"
#tool nuget:?package=xunit.runner.console&version=2.4.1
#addin "nuget:?package=Cake.Incubator&version=7.0.0"
var target = Argument("target", "Default");
var configuration = Argument("Configuration", "Release");
var MockEsiLocation = Argument("MockEsiLocation", "http://127.0.0.1:8080");
var solutionFile = "";
Task("Restore")
.Does(() =>
{
DotNetRestore("./ESIConnectionLibrary/");
});
Task("Build")
.IsDependentOn("Restore")
.Does(() =>
{
DotNetBuild("./ESIConnectionLibrary/",
new DotNetBuildSettings()
{
Configuration = configuration,
ArgumentCustomization = args => args.Append("--no-restore"),
});
});
Task("ReplaceTestingUrl")
.IsDependentOn("Build")
.Does(() =>
{
ReplaceTextInFiles("./**/Internal classes/StaticConnectionStrings.cs", "private static string TestEsiBaseUrl => \"http://127.0.0.1:8080\";", $"private static string TestEsiBaseUrl => \"{MockEsiLocation}\";");
});
Task("Test")
.IsDependentOn("ReplaceTestingUrl")
.Does(() =>
{
var testAssemblies = GetFiles($"./ESIConnectionLibrary/ESIConnectionLibrary.Tests/ESIConnectionLibrary.Tests.csproj");
XUnit2Settings xunitSettings = new XUnit2Settings{
// HtmlReport = true,
OutputDirectory = "./TestOutput"
};
DotNetCoreTestSettings settings = new DotNetCoreTestSettings {
ResultsDirectory = "./TestOutput",
Logger = "trx;LogFileName=TestOutput.xml"
};
foreach(var project in testAssemblies)
{
DotNetCoreTest(settings, project, xunitSettings);
}
}).OnError(exception =>
{
// Handle the error here.
});
Task("Default")
.IsDependentOn("Test");
RunTarget(target);