Esempio n. 1
0
        public void RetrieveTestList(TestMode testMode, Action <ITestAdaptor> callback)
        {
            var testList = new MockTest {
                Name = "Mock Root"
            };
            var list = new List <ITestAdaptor>();

            testList.Children = list;

            var assemblyNames = packageTestRunner.GetAllPackageTestAssemblies(packageTestRunner.PackageVersion);

            if (testMode.HasFlag(TestMode.EditMode))
            {
                EditModeTests.Name = assemblyNames.FirstOrDefault() + ".dll";
                list.Add(EditModeTests);
            }

            if (testMode.HasFlag(TestMode.PlayMode))
            {
                PlayModeTests.Name = assemblyNames.FirstOrDefault() + ".dll";
                list.Add(PlayModeTests);
            }

            callback(testList);
        }
Esempio n. 2
0
        public void TestDeepEquality <T>(T obj, TestMode testMode = TestMode.Default)
        {
            if (_currentTestConfigurations == null || _currentTestConfigurations.Length == 0)
            {
                throw new InvalidOperationException("no test configurations");
            }

            foreach (var config in _currentTestConfigurations)
            {
                if (!testMode.HasFlag(TestMode.AllowNull))
                {
                    Assert.NotNull(obj);
                }

                var clone = Clone(obj, config);

                if (!testMode.HasFlag(TestMode.AllowNull))
                {
                    Assert.NotNull(clone);
                }

                if (typeof(T) == typeof(object))
                {
                    if (ReferenceEquals(obj, null) ^ ReferenceEquals(clone, null))
                    {
                        Assert.True(false, "objects must both have a value or both be null");
                    }
                }

                DeepComparer.Instance.CheckEquality(obj, clone);
            }
        }
 void Run()
 {
     if (m_TestMode.HasFlag(TestMode.EditMode))
     {
         RunMode(TestMode.EditMode);
     }
     else if (m_TestMode.HasFlag(TestMode.PlayMode))
     {
         RunMode(TestMode.PlayMode);
     }
 }