private void LaunchTest(TestInfo m)
        {
            IAgateTest obj = (IAgateTest)Activator.CreateInstance(m.Class);

            if (runningTest)
            {
                System.Diagnostics.Debug.Print("Bug in mono? A second test was launched while the first was still running.");
                return;
            }

            string[] args = { };

            frm.HideBeforeTest();

            try
            {
                runningTest = true;
                LaunchTestModel(obj);
            }
            catch (TargetInvocationException e)
            {
                Exception exRelevant = e.InnerException ?? e;
                string    info       = exRelevant.Message;

                frm.TestExceptionMessage($"{exRelevant.GetType().Name}\n{info}", $"AgateLib Test {m.Name} threw an exception.");
            }
            finally
            {
                runningTest = false;
                frm.ShowAfterTest();
            }
        }
示例#2
0
        private void LaunchTest(TestInfo m)
        {
            IAgateTest obj = (IAgateTest)Activator.CreateInstance(m.Class);

            string[] args = { "--choose" };

            this.Hide();

            try
            {
                obj.Main(args);
            }
            catch (TargetInvocationException e)
            {
                Exception ex_relevant = e.InnerException ?? e;
                string    info        = ex_relevant.Message;

                MessageBox.Show(
                    ex_relevant.GetType().Name + Environment.NewLine + info,
                    "AgateLib Test " + m.Name + " threw an exception.",
                    MessageBoxButtons.OK,
                    MessageBoxIcon.Stop);
            }
            finally
            {
                this.Show();
                this.TopMost = true;
                this.TopMost = false;
                this.Activate();
            }
        }
        private void LaunchTestModel(IAgateTest test)
        {
            using (new AgateWinForms(CommandLineArguments)
                   .AssetPath("Assets")
                   .Initialize()
                   .InstallConsoleCommands())
            {
                test.Run(CommandLineArguments);
            }

            Application.DoEvents();
            GC.Collect();
        }
示例#4
0
        private void AddTest(Type t)
        {
            IAgateTest obj = (IAgateTest)Activator.CreateInstance(t);

            if (tests.ContainsKey(obj.Category) == false)
            {
                tests[obj.Category] = new List <TestInfo>();
            }

            tests[obj.Category].Add(new TestInfo {
                Name = obj.Name, Class = t
            });
        }
示例#5
0
        /// <summary>
        /// Invoked when this page is about to be displayed in a Frame.
        /// </summary>
        /// <param name="e">Event data that describes how this page was reached.
        /// This parameter is typically used to configure the page.</param>
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            Info = (TestInfo)e.Parameter;

            IAgateTest t = (IAgateTest)Activator.CreateInstance(Info.Class);

            if (t is ISceneModelTest)
            {
                RunTest((ISceneModelTest)t);
            }
            else if (t is ISerialModelTest)
            {
                RunTest((ISerialModelTest)t);
            }
        }
示例#6
0
        private static void Add(TypeInfo typeinfo)
        {
            var type = typeinfo.AsType();

            if (mTests.Any(x => x.Class == type))
            {
                return;
            }

            IAgateTest obj = (IAgateTest)Activator.CreateInstance(type);

            mTests.Add(new TestInfo {
                Name = obj.Name, Category = obj.Category, Class = type
            });
        }
示例#7
0
        private static void SetAssetPath(IAgateTest t, AssetLocations assets)
        {
            var assemblyName = t.GetType().GetTypeInfo().Assembly.GetName().Name;

            assets.Path = assemblyName + "/Assets";
        }