You've already forked linux-packaging-mono
Imported Upstream version 6.4.0.137
Former-commit-id: 943baa9f16a098c33e129777827f3a9d20da00d6
This commit is contained in:
parent
e9207cf623
commit
ef583813eb
@@ -30,16 +30,19 @@ namespace NUnit.Framework.Api
|
||||
/// ExpectedExceptionData is a struct used within the framework
|
||||
/// to encapsulate information about an expected exception.
|
||||
/// </summary>
|
||||
[System.Serializable]
|
||||
public struct ExpectedExceptionData
|
||||
{
|
||||
#region Fields
|
||||
|
||||
[System.NonSerialized]
|
||||
private Type expectedExceptionType;
|
||||
private string expectedExceptionName;
|
||||
private string expectedMessage;
|
||||
private MessageMatch matchType;
|
||||
private string userMessage;
|
||||
private string handlerName;
|
||||
[System.NonSerialized]
|
||||
private MethodInfo exceptionHandler;
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -30,6 +30,7 @@ namespace NUnit.Framework.Api
|
||||
/// skipped or was inconclusive. The Label provides a more
|
||||
/// detailed breakdown for use by client runners.
|
||||
/// </summary>
|
||||
[System.Serializable]
|
||||
public class ResultState
|
||||
{
|
||||
private readonly TestStatus status;
|
||||
@@ -135,5 +136,14 @@ namespace NUnit.Framework.Api
|
||||
string s = status.ToString();
|
||||
return label == null || label.Length == 0 ? s : string.Format("{0}:{1}", s, label);
|
||||
}
|
||||
|
||||
public override bool Equals (object o)
|
||||
{
|
||||
if (!(o is ResultState that))
|
||||
return false;
|
||||
|
||||
return that.status.Equals(this.status)
|
||||
&& that.label.Equals (this.label);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -140,6 +140,7 @@ namespace NUnit.Framework
|
||||
/// a success result only if the expected exception is thrown.
|
||||
/// Otherwise, an appropriate failure result is returned.
|
||||
/// </summary>
|
||||
[System.Serializable]
|
||||
public class ExpectedExceptionDecorator : ICommandDecorator
|
||||
{
|
||||
private ExpectedExceptionData exceptionData;
|
||||
|
||||
@@ -31,6 +31,7 @@ namespace NUnit.Framework.Internal
|
||||
/// other selected parameters needed for constructing
|
||||
/// a parameterized test case.
|
||||
/// </summary>
|
||||
[System.Serializable]
|
||||
public class ParameterSet : ITestCaseData, IApplyToTest
|
||||
{
|
||||
#region Instance Fields
|
||||
|
||||
@@ -15,6 +15,7 @@ namespace NUnit.Framework.Internal
|
||||
/// may be of any type. Null values are not permitted, since
|
||||
/// a null entry represents the absence of the key.
|
||||
/// </summary>
|
||||
[System.Serializable]
|
||||
public class PropertyBag : IPropertyBag
|
||||
{
|
||||
#if CLR_2_0 || CLR_4_0
|
||||
|
||||
@@ -6,6 +6,7 @@ namespace NUnit.Framework.Internal
|
||||
/// <summary>
|
||||
/// Represents the result of running a single test case.
|
||||
/// </summary>
|
||||
[System.Serializable]
|
||||
public class TestCaseResult : TestResult
|
||||
{
|
||||
/// <summary>
|
||||
|
||||
@@ -30,6 +30,7 @@ namespace NUnit.Framework.Internal
|
||||
/// <summary>
|
||||
/// The TestResult class represents the result of a test.
|
||||
/// </summary>
|
||||
[System.Serializable]
|
||||
public abstract class TestResult : ITestResult
|
||||
{
|
||||
#region Fields
|
||||
|
||||
@@ -6,6 +6,7 @@ namespace NUnit.Framework.Internal
|
||||
/// <summary>
|
||||
/// Represents the result of running a test suite
|
||||
/// </summary>
|
||||
[System.Serializable]
|
||||
public class TestSuiteResult : TestResult
|
||||
{
|
||||
private int passCount = 0;
|
||||
|
||||
@@ -29,8 +29,10 @@ namespace NUnit.Framework.Internal
|
||||
/// ParameterizedFixtureSuite serves as a container for the set of test
|
||||
/// fixtures created from a given Type using various parameters.
|
||||
/// </summary>
|
||||
[System.Serializable]
|
||||
public class ParameterizedFixtureSuite : TestSuite
|
||||
{
|
||||
[System.NonSerialized]
|
||||
private Type type;
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -30,10 +30,13 @@ namespace NUnit.Framework.Internal
|
||||
/// ParameterizedMethodSuite holds a collection of individual
|
||||
/// TestMethods with their arguments applied.
|
||||
/// </summary>
|
||||
[System.Serializable]
|
||||
public class ParameterizedMethodSuite : TestSuite
|
||||
{
|
||||
[System.NonSerialized]
|
||||
private MethodInfo _method;
|
||||
private bool _isTheory;
|
||||
private bool _isGenericMethod;
|
||||
|
||||
/// <summary>
|
||||
/// Construct from a MethodInfo
|
||||
@@ -44,6 +47,9 @@ namespace NUnit.Framework.Internal
|
||||
{
|
||||
_method = method;
|
||||
_isTheory = method.IsDefined(typeof(TheoryAttribute), true);
|
||||
#if CLR_2_0 || CLR_4_0
|
||||
_isGenericMethod = method.ContainsGenericParameters;
|
||||
#endif
|
||||
this.maintainTestOrder = true;
|
||||
}
|
||||
|
||||
@@ -66,10 +72,8 @@ namespace NUnit.Framework.Internal
|
||||
if (_isTheory)
|
||||
return "Theory";
|
||||
|
||||
#if CLR_2_0 || CLR_4_0
|
||||
if (this.Method.ContainsGenericParameters)
|
||||
if (_isGenericMethod)
|
||||
return "GenericMethod";
|
||||
#endif
|
||||
|
||||
return "ParameterizedMethod";
|
||||
}
|
||||
|
||||
@@ -32,6 +32,7 @@ namespace NUnit.Framework.Internal
|
||||
/// <summary>
|
||||
/// The Test abstract class represents a test within the framework.
|
||||
/// </summary>
|
||||
[System.Serializable]
|
||||
public abstract class Test : ITest, IComparable
|
||||
{
|
||||
#region Fields
|
||||
@@ -66,6 +67,7 @@ namespace NUnit.Framework.Internal
|
||||
/// <summary>
|
||||
/// The System.Type of the fixture for this test, if there is one
|
||||
/// </summary>
|
||||
[System.NonSerialized]
|
||||
private Type fixtureType;
|
||||
|
||||
/// <summary>
|
||||
@@ -76,11 +78,13 @@ namespace NUnit.Framework.Internal
|
||||
/// <summary>
|
||||
/// The SetUp methods.
|
||||
/// </summary>
|
||||
[System.NonSerialized]
|
||||
protected MethodInfo[] setUpMethods;
|
||||
|
||||
/// <summary>
|
||||
/// The teardown methods
|
||||
/// </summary>
|
||||
[System.NonSerialized]
|
||||
protected MethodInfo[] tearDownMethods;
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -30,6 +30,7 @@ namespace NUnit.Framework.Internal
|
||||
/// TestAssembly is a TestSuite that represents the execution
|
||||
/// of tests in a managed assembly.
|
||||
/// </summary>
|
||||
[System.Serializable]
|
||||
public class TestAssembly : TestSuite
|
||||
{
|
||||
/// <summary>
|
||||
|
||||
@@ -31,6 +31,7 @@ namespace NUnit.Framework.Internal
|
||||
/// TestFixture is a surrogate for a user test fixture class,
|
||||
/// containing one or more tests.
|
||||
/// </summary>
|
||||
[System.Serializable]
|
||||
public class TestFixture : TestSuite
|
||||
{
|
||||
#region Constructors
|
||||
|
||||
@@ -38,6 +38,7 @@ namespace NUnit.Framework.Internal
|
||||
/// the Test interface might make it easier to process exceptions
|
||||
/// in an object that aggregates a TestMethod in the future.
|
||||
/// </summary>
|
||||
[System.Serializable]
|
||||
public class TestMethod : Test
|
||||
{
|
||||
#region Fields
|
||||
@@ -45,6 +46,7 @@ namespace NUnit.Framework.Internal
|
||||
/// <summary>
|
||||
/// The test method
|
||||
/// </summary>
|
||||
[System.NonSerialized]
|
||||
internal MethodInfo method;
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -37,6 +37,7 @@ namespace NUnit.Framework.Internal
|
||||
/// <summary>
|
||||
/// TestSuite represents a composite test, which contains other tests.
|
||||
/// </summary>
|
||||
[System.Serializable]
|
||||
public class TestSuite : Test
|
||||
{
|
||||
#region Fields
|
||||
|
||||
@@ -32,6 +32,7 @@ namespace NUnit
|
||||
/// these classes but only implements what is needed within the framework.
|
||||
/// </summary>
|
||||
#if CLR_2_0 || CLR_4_0
|
||||
[System.Serializable]
|
||||
public class ObjectList : System.Collections.Generic.List<object>
|
||||
{
|
||||
/// <summary>
|
||||
|
||||
@@ -54,6 +54,10 @@ namespace NUnitLite.Runner
|
||||
private string outFile;
|
||||
private string includeCategory;
|
||||
private string excludeCategory;
|
||||
private string android;
|
||||
private string ios;
|
||||
private string webassembly;
|
||||
private string remote;
|
||||
|
||||
private bool error = false;
|
||||
|
||||
@@ -171,6 +175,50 @@ namespace NUnitLite.Runner
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the android app to run the tests from
|
||||
/// </summary>
|
||||
public string Android
|
||||
{
|
||||
get
|
||||
{
|
||||
return android;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the iOS app to run the tests from
|
||||
/// </summary>
|
||||
public string iOS
|
||||
{
|
||||
get
|
||||
{
|
||||
return ios;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the WebAssembly process to run the tests from
|
||||
/// </summary>
|
||||
public string WebAssembly
|
||||
{
|
||||
get
|
||||
{
|
||||
return webassembly;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the Remote process to run the tests from
|
||||
/// </summary>
|
||||
public string Remote
|
||||
{
|
||||
get
|
||||
{
|
||||
return remote;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets a flag indicating whether each test should
|
||||
/// be labeled in the output.
|
||||
@@ -349,6 +397,18 @@ namespace NUnitLite.Runner
|
||||
InvalidOption(option);
|
||||
}
|
||||
break;
|
||||
case "android":
|
||||
android = val;
|
||||
break;
|
||||
case "ios":
|
||||
ios = val;
|
||||
break;
|
||||
case "webassembly":
|
||||
webassembly = val;
|
||||
break;
|
||||
case "remote":
|
||||
remote = val;
|
||||
break;
|
||||
default:
|
||||
InvalidOption(option);
|
||||
break;
|
||||
|
||||
@@ -60,7 +60,7 @@ namespace NUnitLite.Runner
|
||||
|
||||
private ITestAssemblyRunner runner;
|
||||
|
||||
private FinallyDelegate finallyDelegate;
|
||||
private FinallyDelegate finallyDelegate = new FinallyDelegate();
|
||||
|
||||
public bool Failure;
|
||||
|
||||
@@ -86,17 +86,36 @@ namespace NUnitLite.Runner
|
||||
{
|
||||
// Set the default writer - may be overridden by the args specified
|
||||
this.writer = writer;
|
||||
this.finallyDelegate = new FinallyDelegate();
|
||||
this.runner = new NUnitLiteTestAssemblyRunner(new NUnitLiteTestAssemblyBuilder(), this.finallyDelegate);
|
||||
this.listener = listener;
|
||||
}
|
||||
|
||||
void TopLevelHandler(object sender, UnhandledExceptionEventArgs e)
|
||||
{
|
||||
// Make sure that the test harness knows this exception was thrown
|
||||
if (this.finallyDelegate != null)
|
||||
this.finallyDelegate.HandleUnhandledExc(e.ExceptionObject as Exception);
|
||||
}
|
||||
void TopLevelHandler(object sender, UnhandledExceptionEventArgs e)
|
||||
{
|
||||
// Make sure that the test harness knows this exception was thrown
|
||||
this.finallyDelegate.HandleUnhandledExc(e.ExceptionObject as Exception);
|
||||
}
|
||||
|
||||
ITestAssemblyRunner DefaultRunner ()
|
||||
{
|
||||
return new NUnitLiteTestAssemblyRunner(new NUnitLiteTestAssemblyBuilder(), this.finallyDelegate);;
|
||||
}
|
||||
|
||||
#if MONODROID_TOOLS
|
||||
ITestAssemblyRunner AndroidRunner (string app)
|
||||
{
|
||||
return new Xamarin.AndroidTestAssemblyRunner(app);
|
||||
}
|
||||
#elif MONOTOUCH_TOOLS
|
||||
ITestAssemblyRunner iOSRunner (string app)
|
||||
{
|
||||
throw new NotImplementedException ();
|
||||
}
|
||||
#elif WASM_TOOLS
|
||||
ITestAssemblyRunner WebAssemblyRunner (string app)
|
||||
{
|
||||
throw new NotImplementedException ();
|
||||
}
|
||||
#endif
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -112,6 +131,36 @@ namespace NUnitLite.Runner
|
||||
this.commandLineOptions = new CommandLineOptions();
|
||||
commandLineOptions.Parse(args);
|
||||
|
||||
if (runner == null) {
|
||||
#if MONODROID_TOOLS
|
||||
if (!string.IsNullOrEmpty (commandLineOptions.Android)) {
|
||||
runner = AndroidRunner (commandLineOptions.Android);
|
||||
} else if (!string.IsNullOrEmpty (commandLineOptions.Remote) && commandLineOptions.Remote.StartsWith ("android:")) {
|
||||
Xamarin.AndroidRemoteRunner.App = commandLineOptions.Remote.Substring (8);
|
||||
runner = DefaultRunner ();
|
||||
} else
|
||||
#elif MONOTOUCH_TOOLS
|
||||
if (!string.IsNullOrEmpty (commandLineOptions.iOS)) {
|
||||
runner = iOSRunner (commandLineOptions.iOS);
|
||||
} else if (!string.IsNullOrEmpty (commandLineOptions.Remote) && commandLineOptions.Remote.StartsWith ("ios:")) {
|
||||
// Xamarin.iOSRemoteRunner.App = commandLineOptions.Remote.Substring (4);
|
||||
// runner = DefaultRunner ();
|
||||
throw new NotImplementedException ();
|
||||
} else
|
||||
#elif WASM_TOOLS
|
||||
if (!string.IsNullOrEmpty (commandLineOptions.WebAssembly)) {
|
||||
runner = WebAssemblyRunner (commandLineOptions.WebAssembly);
|
||||
} else if (!string.IsNullOrEmpty (commandLineOptions.Remote) && commandLineOptions.Remote.StartsWith ("wasm:")) {
|
||||
// Xamarin.WebAssemblyRemoteRunner.App = commandLineOptions.Remote.Substring (5);
|
||||
// runner = DefaultRunner ();
|
||||
throw new NotImplementedException ();
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
runner = DefaultRunner ();
|
||||
}
|
||||
}
|
||||
|
||||
if (commandLineOptions.OutFile != null)
|
||||
this.writer = new StreamWriter(commandLineOptions.OutFile);
|
||||
|
||||
@@ -312,7 +361,7 @@ namespace NUnitLite.Runner
|
||||
string resultFile = commandLineOptions.ResultFile;
|
||||
string resultFormat = commandLineOptions.ResultFormat;
|
||||
|
||||
this.Failure = (result.ResultState == ResultState.Failure);
|
||||
this.Failure = (result.ResultState.Equals(ResultState.Failure) || result.ResultState.Equals(ResultState.Error));
|
||||
|
||||
if (resultFile != null || commandLineOptions.ResultFormat != null)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user