summaryrefslogtreecommitdiff
path: root/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEngine.TestRunner/TestRunner/RemoteHelpers/RemoteTestData.cs
blob: eaf7078c551af2a2364d4470ec33a5bd13c31ce4 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
using System;
using System.Linq;
using NUnit.Framework.Interfaces;
using NUnit.Framework.Internal;
using UnityEngine.TestRunner.NUnitExtensions;

namespace UnityEngine.TestRunner.TestLaunchers
{
    [Serializable]
    internal class RemoteTestData
    {
        public string id;
        public string name;
        public string fullName;
        public int testCaseCount;
        public int ChildIndex;
        public bool hasChildren;
        public bool isSuite;
        public string[] childrenIds;
        public int testCaseTimeout;
        public string[] Categories;
        public bool IsTestAssembly;
        public RunState RunState;
        public string Description;
        public string SkipReason;
        public string ParentId;
        public string UniqueName;
        public string ParentUniqueName;
        public string ParentFullName;

        internal RemoteTestData(ITest test)
        {
            id = test.Id;
            name = test.Name;
            fullName = test.FullName;
            testCaseCount = test.TestCaseCount;
            ChildIndex = -1;
            if (test.Properties["childIndex"].Count > 0)
            {
                ChildIndex = (int)test.Properties["childIndex"][0];
            }
            hasChildren = test.HasChildren;
            isSuite = test.IsSuite;
            childrenIds = test.Tests.Select(t => t.Id).ToArray();
            Categories = test.GetAllCategoriesFromTest().ToArray();
            IsTestAssembly = test is TestAssembly;
            RunState = (RunState)Enum.Parse(typeof(RunState), test.RunState.ToString());
            Description = (string)test.Properties.Get(PropertyNames.Description);
            SkipReason = test.GetSkipReason();
            ParentId = test.GetParentId();
            UniqueName = test.GetUniqueName();
            ParentUniqueName = test.GetParentUniqueName();
            ParentFullName = test.GetParentFullName();
        }
    }
}