コード例 #1
0
        public static AutomationTesterHarness RunTest(Action <AutomationTesterHarness> testToRun, string testDbFolder = null, string staticDataPathOverride = null, string queueItemFolderToAdd = null, double maxTimeToRun = 60)
        {
            if (staticDataPathOverride == null)
            {
                staticDataPathOverride = Path.Combine("..", "..", "..", "..", "StaticData");
            }
#if !__ANDROID__
            // Set the static data to point to the directory of MatterControl
            StaticData.Instance = new MatterHackers.Agg.FileSystemStaticData(staticDataPathOverride);
#endif
            bool showWindow;
            MatterControlUtilities.DataFolderState staticDataState = MatterControlUtilities.MakeNewMatterControlAppDataFolderForTesting(testDbFolder);

            if (queueItemFolderToAdd != null)
            {
                MatterControlUtilities.AddItemsToQueue(queueItemFolderToAdd);
            }

            MatterControlApplication matterControlWindow = MatterControlApplication.CreateInstance(out showWindow);
            AutomationTesterHarness  testHarness         = AutomationTesterHarness.ShowWindowAndExectueTests(matterControlWindow, testToRun, maxTimeToRun);
            MatterControlUtilities.RestoreStaticDataAfterTesting(staticDataState, true);

            return(testHarness);
        }