A game about forced loneliness, made by TACStudios
1using System; 2using System.Collections; 3using System.Collections.Generic; 4using System.Reflection; 5using NUnit.Framework; 6using NUnit.Framework.Internal; 7using NUnit.Framework.Internal.Commands; 8using UnityEngine.TestRunner.NUnitExtensions.Runner; 9 10namespace UnityEngine.TestTools 11{ 12 internal class TestActionCommand : BeforeAfterTestCommandBase<ITestAction> 13 { 14 private static readonly Dictionary<MethodInfo, List<ITestAction>> m_TestActionsCache = new Dictionary<MethodInfo, List<ITestAction>>(); 15 16 public TestActionCommand(TestCommand innerCommand) 17 : base(innerCommand, "BeforeTest", "AfterTest") 18 { 19 if (Test.TypeInfo.Type != null) 20 { 21 BeforeActions = GetTestActions(m_TestActionsCache, Test.Method.MethodInfo); 22 AfterActions = BeforeActions; 23 } 24 } 25 26 protected override bool AllowFrameSkipAfterAction(ITestAction action) 27 { 28 return false; 29 } 30 31 protected override IEnumerator InvokeBefore(ITestAction action, Test test, UnityTestExecutionContext context) 32 { 33 action.BeforeTest(test); 34 yield return null; 35 } 36 37 protected override IEnumerator InvokeAfter(ITestAction action, Test test, UnityTestExecutionContext context) 38 { 39 action.AfterTest(test); 40 yield return null; 41 } 42 43 protected override BeforeAfterTestCommandState GetState(UnityTestExecutionContext context) 44 { 45 // TestActionCommand does not support domain reloads and will not need a persisted state. 46 return new BeforeAfterTestCommandState(); 47 } 48 } 49}