-
Notifications
You must be signed in to change notification settings - Fork 4.8k
/
Copy pathMain.cs
30 lines (26 loc) · 879 Bytes
/
Main.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
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System;
using System.Runtime.CompilerServices;
bool success = RunTest(Dataflow.Run);
success &= RunTest(DeadCodeElimination.Run);
success &= RunTest(FeatureSwitches.Run);
success &= RunTest(ILLinkDescriptor.Run);
success &= RunTest(DependencyInjectionPattern.Run);
return success ? 100 : 1;
static bool RunTest(Func<int> t, [CallerArgumentExpression(nameof(t))] string name = null)
{
Console.WriteLine($"===== Running test {name} =====");
bool success = true;
try
{
success = t() == 100;
}
catch (Exception ex)
{
Console.WriteLine(ex.ToString());
success = false;
}
Console.WriteLine($"===== Test {name} {(success ? "succeeded" : "failed")} =====");
return success;
}