Run() private method

private Run ( UnitTestSettings settings ) : void
settings UnitTestSettings
return void
Esempio n. 1
0
        /// <summary>
        /// Creates a new TestPage visual that in turn will setup and begin a
        /// unit test run.
        /// </summary>
        /// <param name="settings">Test harness settings to be applied.</param>
        /// <returns>A new RootVisual.</returns>
        /// <remarks>Assumes the calling assembly is a test assembly.</remarks>
        public static UIElement CreateTestPage(UnitTestSettings settings)
        {
            UnitTestSystem system = new UnitTestSystem();

            Type testPageType = Environment.OSVersion.Platform == PlatformID.WinCE ? typeof(MobileTestPage) : typeof(TestPage);

            Type testPageInterface = typeof(ITestPage);

            if (settings.TestPanelType != null && testPageInterface.IsAssignableFrom(settings.TestPanelType))
            {
                testPageType = settings.TestPanelType;
            }

            object testPage;

            try
            {
                // Try creating with an instance of the test harness
                testPage = Activator.CreateInstance(testPageType, settings.TestHarness);
            }
            catch
            {
                // Fall back to a standard instance only
                testPage = Activator.CreateInstance(testPageType);
            }

            PrepareTestService(settings, () => system.Run(settings));

            // NOTE: A silent failure would be if the testPanel is not a
            // UIElement, and it returns anyway.
            return(testPage as UIElement);
        }
Esempio n. 2
0
        /// <summary>
        /// Creates a new TestPage visual that in turn will setup and begin a
        /// unit test run.
        /// </summary>
        /// <param name="settings">Test harness settings to be applied.</param>
        /// <returns>A new RootVisual.</returns>
        /// <remarks>Assumes the calling assembly is a test assembly.</remarks>
        public static UIElement CreateTestPage(UnitTestSettings settings)
        {
            UnitTestSystem system = new UnitTestSystem();

            PrepareTestService(settings, () => system.Run(settings));
            return(new TestPage());
        }
        /// <summary>
        /// Creates a new TestPage visual that in turn will setup and begin a 
        /// unit test run.
        /// </summary>
        /// <param name="settings">Test harness settings to be applied.</param>
        /// <returns>A new RootVisual.</returns>
        /// <remarks>Assumes the calling assembly is a test assembly.</remarks>
        public static UIElement CreateTestPage(UnitTestSettings settings)
        {
            UnitTestSystem system = new UnitTestSystem();

            Type testPageType = Environment.OSVersion.Platform == PlatformID.WinCE ? typeof(MobileTestPage) : typeof(TestPage);

            Type testPageInterface = typeof(ITestPage);
            if (settings.TestPanelType != null && testPageInterface.IsAssignableFrom(settings.TestPanelType))
            {
                testPageType = settings.TestPanelType;
            }

            object testPage;
            try
            {
                // Try creating with an instance of the test harness
                testPage = Activator.CreateInstance(testPageType, settings.TestHarness);
            }
            catch
            {
                // Fall back to a standard instance only
                testPage = Activator.CreateInstance(testPageType);
            }

            PrepareTestService(settings, () => system.Run(settings));

            // NOTE: A silent failure would be if the testPanel is not a
            // UIElement, and it returns anyway.
            return testPage as UIElement;
        }
Esempio n. 4
0
 /// <summary>
 /// Creates a new TestPage visual that in turn will setup and begin a 
 /// unit test run.
 /// </summary>
 /// <param name="settings">Test harness settings to be applied.</param>
 /// <returns>A new RootVisual.</returns>
 /// <remarks>Assumes the calling assembly is a test assembly.</remarks>
 public static UIElement CreateTestPage(UnitTestSettings settings)
 {
     UnitTestSystem system = new UnitTestSystem();
     PrepareTestService(settings, () => system.Run(settings));
     return new TestPage();
 }