зеркало из
1
0
Форкнуть 0
xamarinstudio.xunit/XUnitRunner/Program.cs

68 строки
1.8 KiB
C#
Исходник Постоянная ссылка Обычный вид История

2016-06-30 18:20:11 +03:00
using System;
2017-09-29 02:25:32 +03:00
using System.Reflection;
using System.Threading.Tasks;
2016-06-30 18:20:11 +03:00
using MonoDevelop.Core.Execution;
2017-09-29 02:25:32 +03:00
using RollbarDotNet;
2016-06-30 18:20:11 +03:00
namespace XUnitRunner
{
class MainClass
{
public static void Main(string[] args)
{
2017-06-16 21:41:22 +03:00
if (args.Length == 1)
{
XUnitRunner.PreloadAssemblies();
var runner = new XUnitRunner();
var info = runner.GetTestInfo(args[0], null);
return;
}
2017-09-29 02:25:32 +03:00
RegisterRollbar();
2016-06-30 18:20:11 +03:00
XUnitRunner.PreloadAssemblies();
RemoteProcessServer server = new RemoteProcessServer();
2017-06-16 21:41:22 +03:00
server.Connect(args, new RemoteXUnitRunner(server));
2016-06-30 18:20:11 +03:00
}
2017-09-29 02:25:32 +03:00
private static void RegisterRollbar()
{
// IMPORTANT: if no .runsettings file is found, use the extension setting from environment variable.
var enabledString = Environment.GetEnvironmentVariable("MONODEVELOP_XUNIT_ROLLBAR_ENABLED")?.ToUpperInvariant();
if (enabledString == null) {
// IMPORTANT: by default enable rollbar.
enabledString = "FALSE";
}
bool enabled;
if (!bool.TryParse(enabledString, out enabled)) {
enabled = true;
}
if (!enabled) {
return;
}
Console.WriteLine($"This extension uses Rollbar to log information. To enable logging, set environment variable MONODEVELOP_XUNIT_ROLLBAR_ENABLED to TRUE");
2017-09-29 02:25:32 +03:00
Rollbar.Init(new RollbarConfig {
AccessToken = "375079eb85e54e388ef1a336a6bdc353",
2017-09-29 02:25:32 +03:00
Environment = "production"
});
var version = Assembly.GetExecutingAssembly().GetName().Version.ToString();
var userName = $"{version}";
Rollbar.PersonData(() => new Person(version) {
UserName = userName
});
AppDomain.CurrentDomain.UnhandledException += (sender, args) => {
Rollbar.Report(args.ExceptionObject as System.Exception);
};
TaskScheduler.UnobservedTaskException += (sender, args) => {
Rollbar.Report(args.Exception);
};
}
2016-06-30 18:20:11 +03:00
}
}