Implemented NUnit Ignore attribute support

dependabot/npm_and_yarn/BuildServer/eslint-7.2.0
Inga 🏳‍🌈 11 years ago
parent 580e183b67
commit 85da2c86fc
  1. 23
      DotNetBuilder/NUnitTester.cs

@ -1,15 +1,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq; using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using NuGet;
using NUnit.Core; using NUnit.Core;
using NUnit.Framework;
using System.Reflection;
using NUnit.Util;
namespace MicroBuildServer.DotNetBuilder namespace MicroBuildServer.DotNetBuilder
{ {
@ -24,6 +16,11 @@ namespace MicroBuildServer.DotNetBuilder
private bool runFail; private bool runFail;
private bool suiteFail; private bool suiteFail;
private static bool IsSuccess(TestResult result)
{
return result.IsSuccess || result.ResultState == ResultState.Ignored;
}
private static string FormatResult(TestResult result) private static string FormatResult(TestResult result)
{ {
var additional = new List<string>(); var additional = new List<string>();
@ -39,6 +36,10 @@ namespace MicroBuildServer.DotNetBuilder
{ {
additional.Add("fail"); additional.Add("fail");
} }
else if (result.ResultState == ResultState.Ignored)
{
additional.Add("ignored");
}
else else
{ {
additional.Add("status unknown"); additional.Add("status unknown");
@ -61,7 +62,7 @@ namespace MicroBuildServer.DotNetBuilder
{ {
var message = string.Format("Run finished: {0}", FormatResult(result)); var message = string.Format("Run finished: {0}", FormatResult(result));
if (!result.IsSuccess && !runFail) if (!IsSuccess(result) && !runFail)
{ {
Messages.Add(Response.Message.CreateError(message)); Messages.Add(Response.Message.CreateError(message));
} }
@ -81,7 +82,7 @@ namespace MicroBuildServer.DotNetBuilder
{ {
var message = string.Format("Suite finished: {0}", FormatResult(result)); var message = string.Format("Suite finished: {0}", FormatResult(result));
if (!result.IsSuccess && !suiteFail) if (!IsSuccess(result) && !suiteFail)
{ {
Messages.Add(Response.Message.CreateError(message)); Messages.Add(Response.Message.CreateError(message));
} }
@ -106,7 +107,7 @@ namespace MicroBuildServer.DotNetBuilder
{ {
var message = string.Format("Test finished: {0}", FormatResult(result)); var message = string.Format("Test finished: {0}", FormatResult(result));
if (!result.IsSuccess) if (!IsSuccess(result))
{ {
Messages.Add(Response.Message.CreateError(message)); Messages.Add(Response.Message.CreateError(message));
} }

Loading…
Cancel
Save