Paradox Game Engine  v1.0.0 beta06
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Macros Pages
TestRocks.cs
Go to the documentation of this file.
1 // TestRocks.cs: Helpers
2 //
3 // Authors:
4 // Sebastien Pouliot <sebastien@xamarin.com>
5 //
6 // Copyright 2011-2012 Xamarin Inc.
7 //
8 // Licensed under the Apache License, Version 2.0 (the "License");
9 // you may not use this file except in compliance with the License.
10 // You may obtain a copy of the License at
11 //
12 // http://www.apache.org/licenses/LICENSE-2.0
13 //
14 // Unless required by applicable law or agreed to in writing, software
15 // distributed under the License is distributed on an "AS IS" BASIS,
16 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 // See the License for the specific language governing permissions and
18 // limitations under the License.
19 //
20 
21 using NUnit.Framework.Api;
22 
23 namespace Android.NUnitLite
24 {
25 
26  static class TestRock
27  {
28 
29  const string NUnitFrameworkExceptionPrefix = "NUnit.Framework.";
30 
31  static public bool IsIgnored(this ITestResult result)
32  {
33  return (result.ResultState.Status == TestStatus.Skipped);
34  }
35 
36  static public bool IsSuccess(this ITestResult result)
37  {
38  return (result.ResultState.Status == TestStatus.Passed);
39  }
40 
41  static public bool IsFailure(this ITestResult result)
42  {
43  return (result.ResultState.Status == TestStatus.Failed);
44  }
45 
46  static public bool IsInconclusive(this ITestResult result)
47  {
48  return (result.ResultState.Status == TestStatus.Inconclusive);
49  }
50 
51  // remove the nunit exception message from the "real" message
52  static public string GetMessage(this ITestResult result)
53  {
54  string m = result.Message;
55  if (m == null)
56  return "Unknown error";
57  if (!m.StartsWith(NUnitFrameworkExceptionPrefix))
58  return m;
59  return m.Substring(m.IndexOf(" : ") + 3);
60  }
61  }
62 }
static string GetMessage(this ITestResult result)
Definition: TestRocks.cs:52
static bool IsIgnored(this ITestResult result)
Definition: TestRocks.cs:31
static bool IsFailure(this ITestResult result)
Definition: TestRocks.cs:41
static bool IsInconclusive(this ITestResult result)
Definition: TestRocks.cs:46
static bool IsSuccess(this ITestResult result)
Definition: TestRocks.cs:36