A game about forced loneliness, made by TACStudios
1using System; 2using System.Collections; 3using NUnit.Framework.Interfaces; 4using NUnit.Framework.Internal; 5using NUnit.Framework.Internal.Commands; 6using UnityEngine.TestRunner.NUnitExtensions; 7using UnityEngine.TestRunner.NUnitExtensions.Runner; 8 9namespace UnityEngine.TestTools 10{ 11 internal class IgnoreTestCommand : DelegatingTestCommand, IEnumerableTestMethodCommand 12 { 13 private ITest _test; 14 public IgnoreTestCommand(TestCommand innerCommand, ITest test) : base(innerCommand) 15 { 16 _test = test; 17 } 18 19 public override TestResult Execute(ITestExecutionContext context) 20 { 21 throw new NotImplementedException("Use ExecuteEnumerable"); 22 } 23 24 public IEnumerable ExecuteEnumerable(ITestExecutionContext context) 25 { 26 var ignoreTests = ((UnityTestExecutionContext) context).IgnoreTests; 27 if (ignoreTests != null && ignoreTests.Length > 0) 28 { 29 var fullName = _test.GetFullNameWithoutDllPath(); 30 foreach (var ignoreTest in ignoreTests) 31 { 32 if (ignoreTest.test.Equals(fullName)) 33 { 34 context.CurrentResult.SetResult(ResultState.Ignored,ignoreTest.ignoreComment); 35 yield break; 36 } 37 } 38 } 39 if (innerCommand is IEnumerableTestMethodCommand) 40 { 41 var executeEnumerable = ((IEnumerableTestMethodCommand)innerCommand).ExecuteEnumerable(context); 42 foreach (var iterator in executeEnumerable) 43 { 44 yield return iterator; 45 } 46 } 47 else 48 { 49 context.CurrentResult = innerCommand.Execute(context); 50 } 51 } 52 } 53}