A game about forced loneliness, made by TACStudios
1using System;
2using System.Collections;
3using System.Collections.Generic;
4using System.Reflection;
5using NUnit.Framework.Internal;
6using NUnit.Framework.Internal.Commands;
7using UnityEngine.TestRunner.NUnitExtensions.Runner;
8
9namespace UnityEngine.TestTools
10{
11 internal class OuterUnityTestActionCommand : BeforeAfterTestCommandBase<IOuterUnityTestAction>
12 {
13 private static readonly Dictionary<MethodInfo, List<IOuterUnityTestAction>> m_TestActionsCache = new Dictionary<MethodInfo, List<IOuterUnityTestAction>>();
14 public OuterUnityTestActionCommand(TestCommand innerCommand)
15 : base(innerCommand, "BeforeTest", "AfterTest")
16 {
17 if (Test.TypeInfo.Type != null)
18 {
19 BeforeActions = GetTestActions(m_TestActionsCache, Test.Method.MethodInfo);
20 AfterActions = BeforeActions;
21 }
22 }
23
24 protected override IEnumerator InvokeBefore(IOuterUnityTestAction action, Test test, UnityTestExecutionContext context)
25 {
26 return action.BeforeTest(test);
27 }
28
29 protected override IEnumerator InvokeAfter(IOuterUnityTestAction action, Test test, UnityTestExecutionContext context)
30 {
31 return action.AfterTest(test);
32 }
33
34 protected override BeforeAfterTestCommandState GetState(UnityTestExecutionContext context)
35 {
36 return context.OuterUnityTestActionState;
37 }
38 }
39}