コード例 #1
0
        /// <summary>
        /// Execute the tests in the assembly, passing in
        /// a list of arguments.
        /// </summary>
        /// <param name="args">arguments for NUnitLite to use</param>
        public void Execute()
        {
#if TIZEN
            #region tronghieu.d - Create new thread to run test and mainthread waiting for invoke test method.
            TAsyncThreadMgr asyncThreadMgr = TAsyncThreadMgr.GetInstance();
            ManualResetEvent methodExecutionResetEvent = asyncThreadMgr.GetMethodExecutionResetEvent();
            methodExecutionResetEvent.Reset();

            Task t = Task.Run(() =>
                {
                    _textRunner.Execute(args);
                    asyncThreadMgr.SetData(null, null, null, null, false);
                    methodExecutionResetEvent.Set();
                });
            t.GetAwaiter().OnCompleted(() =>
                {
                    OnSingleTestDone(TSettings.GetInstance().GetSingleTestDoneEventArgs());
                });
            methodExecutionResetEvent.WaitOne();
            asyncThreadMgr.RunTestMethod();
            #endregion
#else
            new TextRunner(_testAssembly).Execute(args);
#endif
        }
コード例 #2
0
ファイル: SetUpTearDownItem.cs プロジェクト: yunmiha/TizenFX
        public void RunSetupForTC(TestExecutionContext context)
        {
            _setUpWasRun = true;
            TAsyncThreadMgr asyncThreadMgr = TAsyncThreadMgr.GetInstance();

            asyncThreadMgr.SetData(this);
        }
コード例 #3
0
ファイル: Program.cs プロジェクト: wonrst/TizenFX
        protected override void OnCreate()
        {
            base.OnCreate();

            tlog.Debug(tag, "OnCreate() START!");

            mainPid = Process.GetCurrentProcess().Id;
            mainTid = Thread.CurrentThread.ManagedThreadId;

            window = NUIApplication.GetDefaultWindow();
            window.BackgroundColor = Color.Green;

            root = new View()
            {
                Size                   = new Size(100, 100),
                BackgroundColor        = Color.White,
                PositionUsesPivotPoint = true,
                ParentOrigin           = ParentOrigin.Center,
                PivotPoint             = PivotPoint.Center,
            };

            layer = window.GetDefaultLayer();
            layer.Add(root);

            mainTitle = new TextLabel()
            {
                MultiLine              = true,
                Text                   = title + $"Process ID: {Process.GetCurrentProcess().Id} \nThread ID: {Thread.CurrentThread.ManagedThreadId}\n",
                PixelSize              = textSize,
                BackgroundColor        = Color.Cyan,
                Size                   = new Size(window.WindowSize.Width * 0.9f, window.WindowSize.Height * 0.9f, 0),
                PositionUsesPivotPoint = true,
                ParentOrigin           = ParentOrigin.Center,
                PivotPoint             = PivotPoint.Center,
            };
            root.Add(mainTitle);

            Thread.CurrentThread.Name = "main";
            trunner = new NUnitLite.TUnit.TRunner();
            trunner.LoadTestsuite();

            asyncThreadMgr            = TAsyncThreadMgr.GetInstance();
            methodExecutionResetEvent = asyncThreadMgr.GetMethodExecutionResetEvent();
            methodExecutionResetEvent.Reset();

            Task t = Task.Run(() =>
            {
                Thread.CurrentThread.Name = "textRunner";
                trunner._textRunner.Execute(trunner.args);
                asyncThreadMgr.SetData(null, null, null, null, false);
                methodExecutionResetEvent.Set();
            });

            eventThreadCallback = new EventThreadCallback(new EventThreadCallback.CallbackDelegate(ProcessTest));
            eventThreadCallback.Trigger();
        }