|
1 | 1 | using System;
|
2 |
| -using System.Collections; |
3 |
| -using System.Linq; |
| 2 | +using System.Collections.Generic; |
4 | 3 | using System.Threading;
|
5 | 4 |
|
6 | 5 | using WatchKit;
|
7 | 6 | using Foundation;
|
8 | 7 |
|
9 |
| -using NUnit.Framework.Internal.Filters; |
10 | 8 | using MonoTouch.NUnit.UI;
|
11 | 9 |
|
12 | 10 | public static partial class TestLoader
|
@@ -70,16 +68,19 @@ public override void Awake (NSObject context)
|
70 | 68 |
|
71 | 69 | void LoadTests ()
|
72 | 70 | {
|
| 71 | + var excludeCategories = new [] { |
| 72 | + "MobileNotWorking", |
| 73 | + "NotOnMac", |
| 74 | + "NotWorking", |
| 75 | + "ValueAdd", |
| 76 | + "CAS", |
| 77 | + "InetAccess", |
| 78 | + "NotWorkingLinqInterpreter", |
| 79 | + "RequiresBSDSockets", |
| 80 | + "BitcodeNotSupported", |
| 81 | + }; |
73 | 82 | runner = new WatchOSRunner ();
|
74 |
| - var categoryFilter = new NotFilter (new CategoryExpression ("MobileNotWorking,NotOnMac,NotWorking,ValueAdd,CAS,InetAccess,NotWorkingLinqInterpreter,RequiresBSDSockets,BitcodeNotSupported").Filter); |
75 |
| - if (!string.IsNullOrEmpty (Environment.GetEnvironmentVariable ("NUNIT_FILTER_START"))) { |
76 |
| - var firstChar = Environment.GetEnvironmentVariable ("NUNIT_FILTER_START") [0]; |
77 |
| - var lastChar = Environment.GetEnvironmentVariable ("NUNIT_FILTER_END") [0]; |
78 |
| - var nameFilter = new NameStartsWithFilter () { FirstChar = firstChar, LastChar = lastChar }; |
79 |
| - runner.Filter = new AndFilter (categoryFilter, nameFilter); |
80 |
| - } else { |
81 |
| - runner.Filter = categoryFilter; |
82 |
| - } |
| 83 | + runner.ExcludedCategories = new HashSet<string> (excludeCategories); |
83 | 84 | runner.Add (GetType ().Assembly);
|
84 | 85 | TestLoader.AddTestAssemblies (runner);
|
85 | 86 | ThreadPool.QueueUserWorkItem ((v) =>
|
@@ -153,35 +154,3 @@ partial void RunTests (NSObject obj)
|
153 | 154 | }
|
154 | 155 | }
|
155 | 156 | }
|
156 |
| - |
157 |
| -class NameStartsWithFilter : NUnit.Framework.Internal.TestFilter |
158 |
| -{ |
159 |
| - public char FirstChar; |
160 |
| - public char LastChar; |
161 |
| - |
162 |
| - public override bool Match (NUnit.Framework.Api.ITest test) |
163 |
| - { |
164 |
| - if (test is NUnit.Framework.Internal.TestAssembly) |
165 |
| - return true; |
166 |
| - |
167 |
| - var method = test as NUnit.Framework.Internal.TestMethod; |
168 |
| - if (method != null) |
169 |
| - return Match (method.Parent); |
170 |
| - |
171 |
| - var name = !string.IsNullOrEmpty (test.Name) ? test.Name : test.FullName; |
172 |
| - bool rv; |
173 |
| - if (string.IsNullOrEmpty (name)) { |
174 |
| - rv = true; |
175 |
| - } else { |
176 |
| - var z = Char.ToUpperInvariant (name [0]); |
177 |
| - rv = z >= Char.ToUpperInvariant (FirstChar) && z <= Char.ToUpperInvariant (LastChar); |
178 |
| - } |
179 |
| - |
180 |
| - return rv; |
181 |
| - } |
182 |
| - |
183 |
| - public override bool Pass (NUnit.Framework.Api.ITest test) |
184 |
| - { |
185 |
| - return Match (test); |
186 |
| - } |
187 |
| -} |
0 commit comments