示例#1
0
        public void Main(AbcCode code)
        {
            if (_fixtures.Count <= 0)
            {
                return;
            }

            foreach (var fixture in _fixtures)
            {
                RunTestFixture(code, fixture);
            }

            code.CallStatic(GetMethod(NUnitMethodId.TestRunner_Run), null);
        }
示例#2
0
        private void RunTest(AbcCode code, IMethod test)
        {
            var testFixture = test.DeclaringType;

            var       testType     = GetType(NUnitTypeId.Test);
            var       testInstance = GetInstance(NUnitTypeId.Test);
            const int varTest      = 1;

            code.CreateInstance(testInstance);
            code.SetLocal(varTest);

            code.GetLocal(varTest);
            code.PushString(test.FullName);
            code.SetProperty(testType, "Name");

            code.GetLocal(varTest);
            code.PushString(testFixture.FullName);
            code.SetProperty(testType, "SuiteName");

            string desc = test.GetTestDescription();

            if (!string.IsNullOrEmpty(desc))
            {
                code.GetLocal(varTest);
                code.PushString(desc);
                code.SetProperty(testType, "Description");
            }

            desc = testFixture.GetTestDescription();
            if (!string.IsNullOrEmpty(desc))
            {
                code.GetLocal(varTest);
                code.PushString(desc);
                code.SetProperty(testType, "SuiteDescription");
            }

            var func = DefineTestRunner(test);

            code.GetLocal(varTest);
            code.GetStaticFunction(func);
            //code.CallSetter(testType, "Func");
            code.SetField(testType, "Func");

            //register test in FlashTestRunner
            code.CallStatic(GetMethod(NUnitMethodId.TestRunner_Register), () => code.GetLocal(varTest));
        }