Exemplo n.º 1
0
        public MainPage()
        {
            InitializeComponent();

            SupportedOrientations = SupportedPageOrientation.Portrait | SupportedPageOrientation.Landscape;

            var settings = UnitTestSystem.CreateDefaultSettings();

            settings.TestAssemblies.Add(typeof(Tags).Assembly);

            settings.SampleTags.Clear();
            settings.SampleTags.Add(Tags.Model);
            settings.SampleTags.Add(Tags.ViewModel);
            settings.SampleTags.Add(Tags.WebService);
            settings.ShowTagExpressionEditor = true;

            Content = UnitTestSystem.CreateTestPage(settings);

            var imtp = Content as IMobileTestPage;

            if (imtp != null)
            {
                BackKeyPress += (x, xe) => xe.Cancel = imtp.NavigateBack();
            }
        }
Exemplo n.º 2
0
        public static void StartTestRunnerImmediate(this Application application)
        {
            UnitTestSettings settings = UnitTestSystem.CreateDefaultSettings();

            settings.StartRunImmediately = true;
            application.RootVisual       = UnitTestSystem.CreateTestPage(settings);
        }
Exemplo n.º 3
0
        private void Application_Startup(object sender, StartupEventArgs e)
        {
            var settings = UnitTestSystem.CreateDefaultSettings();

            settings.StartRunImmediately = true;
            this.RootVisual = UnitTestSystem.CreateTestPage(settings);
        }
Exemplo n.º 4
0
        public static void RunTests(Application app)
        {
            UnitTestSettings settings = UnitTestSystem.CreateDefaultSettings();

            settings.StartRunImmediately     = SuppressTagExpressionEditor();
            settings.ShowTagExpressionEditor = !SuppressTagExpressionEditor();
            settings.TestHarness             = new AgTestHarness();
            TestHarness = (UnitTestHarness)settings.TestHarness;
            settings.TestAssemblies.Clear();
            settings.TestAssemblies.Add(Assembly.GetCallingAssembly());
            if (IsGUI())
            {
                string categories = (string)HtmlPage.Window.Eval("window.external.GetIgnoreCategories();");
                IgnoredCategories.AddRange(categories.Split(';'));
                settings.LogProviders.Clear();
                settings.LogProviders.Add(new SilverlightTestGUILog());
                TestHarness.TestHarnessCompleted += TestHarnessCompleted;
            }
            else
            {
                IgnoredCategories.Add("TODO");
            }

            UnitTestProviders.Providers.Add(new BaseUnitTestProvider());
            app.RootVisual = CreateRootVisual(settings);
        }
Exemplo n.º 5
0
        private void Application_Startup(object sender, StartupEventArgs e)
        {
            var settings = UnitTestSystem.CreateDefaultSettings();

            //settings. = true;
            RootVisual = UnitTestSystem.CreateTestPage(settings);
        }
Exemplo n.º 6
0
        // Constructor
        public MainPage()
        {
            InitializeComponent();
            this.Loaded += delegate(object sender, RoutedEventArgs e)
            {
                if (runUnitTests)
                {
                    UnitTestSettings settings = UnitTestSystem.CreateDefaultSettings();

                    if (null != Deployment.Current)
                    {
                        var parts            = Deployment.Current.Parts;
                        var assembliesToLoad = new List <string> {
                            "UnitTest_S3", "UnitTest_SimpleDB", "UnitTest_SQS"
                        };                                                                                              //ADD THE NAME OF THE ASSEMBLY TO TEST HERE AND LOAD IT.
                        int count = 0;

                        //Clear all the test-assemblies.
                        settings.TestAssemblies.Clear();

                        //Algorithm.
                        //0.NOTE: ADD THE NAME OF THE ASSEMBLIES TO TEST MANUALLY.
                        //1.Assembly.Load() cannot load assemblies as it would do in a normal .NET applications.
                        //Hence, the only way to do is to make a explicit reference to them from this main executing assembly(.exe, a Windows Phone Application).
                        //Reason, to enable loading assemblies dynamically, they need to be signed by Windows Market.

                        //2. Specify the assemblies that need to be tested explicitly to the testing runtime=> UnitTestSettings.TestAssemblies() method.
                        foreach (var part in parts)
                        {
                            var assemblyName = part.Source.Replace(".dll", string.Empty);
                            if (!assembliesToLoad.Contains(assemblyName))
                            {
                                continue;
                            }

                            var assembly = Assembly.Load(assemblyName);
                            count++;

                            settings.TestAssemblies.Add(assembly);
                            if (count >= assembliesToLoad.Count)
                            {
                                break;
                            }
                        }

                        UserControl content = UnitTestSystem.CreateTestPage(settings) as UserControl;
                        (Application.Current.RootVisual as PhoneApplicationFrame).Content = content;
                        (Application.Current.RootVisual as PhoneApplicationFrame).Padding = new Thickness(-50);

                        IMobileTestPage imtp = (Application.Current.RootVisual as PhoneApplicationFrame).Content as IMobileTestPage;

                        if (imtp != null)
                        {
                            BackKeyPress += (x, xe) => xe.Cancel = imtp.NavigateBack();
                        }
                    }
                }
            };
        }
Exemplo n.º 7
0
        private void Application_Startup(object sender, StartupEventArgs e)
        {
            UnitTestSystem.RegisterUnitTestProvider(new UnitTestProvider());
            UnitTestSettings settings = UnitTestSystem.CreateDefaultSettings();

            settings.SortTestClasses = false;
            settings.SortTestMethods = false;
            RootVisual = UnitTestSystem.CreateTestPage(settings);
        }
Exemplo n.º 8
0
        private void Application_Startup(object sender, StartupEventArgs e)
        {
            NUnit.Framework.Assert.IsTrue(true); // force NUnitFarmework.dll to load
            UnitTestSystem.RegisterUnitTestProvider(new NUnitProvider());
            UnitTestSettings settings = UnitTestSystem.CreateDefaultSettings();

            settings.TestAssemblies.Add(typeof(global::FSharp.Core.Unittests.LibraryTestFx).Assembly);
            RootVisual = UnitTestSystem.CreateTestPage(settings);
        }
Exemplo n.º 9
0
        private void Application_Startup(object sender, StartupEventArgs e)
        {
            // Hook up and execute this test project
            // For details: http://www.jeff.wilcox.name/fwlink/?0e0slb2
            UnitTestSettings settings = UnitTestSystem.CreateDefaultSettings();

            settings.TestService = null;
            this.RootVisual      = UnitTestSystem.CreateTestPage(settings);
        }
Exemplo n.º 10
0
        private void Application_Startup(object sender, StartupEventArgs e)
        {
            var settings = UnitTestSystem.CreateDefaultSettings();

            settings.StartRunImmediately     = false;
            settings.ShowTagExpressionEditor = true;

            RootVisual = UnitTestSystem.CreateTestPage(settings);
        }
Exemplo n.º 11
0
        private void PhoneApplicationPage_Loaded(object sender, RoutedEventArgs e)
        {
            var testSettings = UnitTestSystem.CreateDefaultSettings();

            testSettings.TestAssemblies.Add(Assembly.GetExecutingAssembly());

            var testPage = UnitTestSystem.CreateTestPage(testSettings) as IMobileTestPage;

            BackKeyPress += (x, xe) => xe.Cancel = testPage.NavigateBack();
            (Application.Current.RootVisual as PhoneApplicationFrame).Content = testPage;
        }
Exemplo n.º 12
0
        // Constructor
        public MainPage()
        {
            InitializeComponent();
            LogProvider fileLogProvider = new FileLogProvider();
            var         settings        = UnitTestSystem.CreateDefaultSettings();

            settings.LogProviders.Add(fileLogProvider);

            Content       = UnitTestSystem.CreateTestPage(settings);
            BackKeyPress += (x, xe) => xe.Cancel = (Content as IMobileTestPage).NavigateBack();
        }
Exemplo n.º 13
0
        private void MainPage_Loaded(object sender, RoutedEventArgs e)
        {
            SystemTray.IsVisible = false;
            var unitTestSettings = UnitTestSystem.CreateDefaultSettings();

            unitTestSettings.TestHarness.TestHarnessCompleted += HandleTestCompleted;
            var testPage = UnitTestSystem.CreateTestPage() as IMobileTestPage;

            BackKeyPress += (x, xe) => xe.Cancel = testPage.NavigateBack();
            (Application.Current.RootVisual as PhoneApplicationFrame).Content = testPage;
        }
Exemplo n.º 14
0
        private void Application_Startup(object sender, StartupEventArgs e)
        {
            UnitTestSettings settings = UnitTestSystem.CreateDefaultSettings();

            settings.LogProviders.Add(new MyLogProvider());

            // uncomment this to reduce the number of test cases
            // settings.TestClassesToRun.Add("IncludeTests");
            vsProvider.TestRunId = Guid.NewGuid().ToString();
            settings.LogProviders.Add(vsProvider);
            settings.TestHarness.TestHarnessCompleted += new EventHandler <TestHarnessCompletedEventArgs>(TestHarness_TestHarnessCompleted);
            this.RootVisual = UnitTestSystem.CreateTestPage(settings);
        }
Exemplo n.º 15
0
        public static UIElement CreateTestPage()
        {
            UnitTestProvider.Register();

            var unitTestSettings = UnitTestSystem.CreateDefaultSettings();

            unitTestSettings.TestAssemblies.Clear();
            unitTestSettings.TestAssemblies.Add(typeof(xunit_silverlight.App).Assembly);
            unitTestSettings.TestAssemblies.Add(typeof(xunit.extensions_silverlight.App).Assembly);
            unitTestSettings.ShowTagExpressionEditor = true;
            unitTestSettings.SampleTags = new[] { "All", "XunitFixesTests", "SanityCheckTests" };

            return(UnitTestSystem.CreateTestPage(unitTestSettings));
        }
Exemplo n.º 16
0
        public MainPage()
        {
            InitializeComponent();
            SupportedOrientations = SupportedPageOrientation.Portrait;

            var settings = UnitTestSystem.CreateDefaultSettings();

            Content = UnitTestSystem.CreateTestPage(settings);
            var imtp = Content as IMobileTestPage;

            if (imtp != null)
            {
                BackKeyPress += (x, xe) => xe.Cancel = imtp.NavigateBack();
            }
        }
Exemplo n.º 17
0
        public UIElement StartRun(IEnumerable <Assembly> assemblyToTest)
        {
            if (assemblyToTest == null)
            {
                throw new ArgumentNullException("assemblyToTest");
            }

            UnitTestSettings unitTestSettings = UnitTestSystem.CreateDefaultSettings();

            foreach (var assembly in assemblyToTest)
            {
                unitTestSettings.TestAssemblies.Add(assembly);
            }

            return(UnitTestSystem.CreateTestPage(unitTestSettings));
        }
        private void Application_Startup(object sender, StartupEventArgs e)
        {
            var settings = UnitTestSystem.CreateDefaultSettings();

            settings.TestAssemblies.Clear();

            Func <Type, bool> IsTestClass = type => type.IsDefined(typeof(TestClassAttribute), true);
            var testAssemblies            = CurrentAssemblies.Where(ass => ass.GetTypes().Any(IsTestClass));

            // Add all assemblies containing test classes to the unit test system.
            foreach (var assembly in testAssemblies)
            {
                settings.TestAssemblies.Add(assembly);
            }
            RootVisual = UnitTestSystem.CreateTestPage(settings);
        }
Exemplo n.º 19
0
 /// <summary>
 /// Initializes a new instance of the App class.
 /// </summary>
 public App()
 {
     Startup += delegate
     {
         UnitTestSettings settings = UnitTestSystem.CreateDefaultSettings();
         settings.SampleTags = new System.Collections.Generic.List <string>
         {
             "All",
             "ImplicitStyleManagerTest",
             "ImplicitStyleManagerTest-DP",
             "ImplicitStyleManagerTest+InvalidResourceExceptionTest",
             "(ImplicitStyleManagerTest+InvalidResourceExceptionTest)-DP",
             "ImplicitStyleManagerTest*DP",
             "!DP",
         };
         RootVisual = UnitTestSystem.CreateTestPage(settings);
     };
 }
Exemplo n.º 20
0
        // Constructor
        public MainPage()
        {
            InitializeComponent();
            const bool runUnitTests = true;

            if (runUnitTests)
            {
                UnitTestSettings settings = UnitTestSystem.CreateDefaultSettings();
#if AUTOUNITTEST
                settings.StartRunImmediately               = true;
                settings.ShowTagExpressionEditor           = false;
                settings.TestHarness.TestHarnessCompleted += TestRunCompletedCallback;
#endif


                Content = UnitTestSystem.CreateTestPage(settings);
            }
        }
Exemplo n.º 21
0
        private UnitTestSettings ConfigureSettings()
        {
#if MSTest2009July || MSTest2009October || MSTest2009November
            var settings = UnitTestSystem.CreateDefaultSettings();
#else
            var settings = new UnitTestSettings();
            settings.TestHarness = new UnitTestHarness();

            DebugOutputProvider item = new DebugOutputProvider();
            item.ShowAllFailures = true;
            settings.LogProviders.Add(item);
            try
            {
                VisualStudioLogProvider visualStudioLogProvider = new VisualStudioLogProvider();
                settings.LogProviders.Add(visualStudioLogProvider);
            }
            catch
            {
            }

            // Don't enable a U.I. when not specifying the U.I. Mode.
            if (!_clientTestRunConfiguration.WindowGeometry.ShouldShowWindow)
            {
                var statLightTestPage = new StatLightTestPage();
                settings.TestHarness.TestPage = statLightTestPage;

                settings.TestPanelType = typeof(StatLightTestPage);
            }

            settings.StartRunImmediately     = true;
            settings.ShowTagExpressionEditor = false;
            settings.TestService             = null;
#endif
            // Below is the custom stuff...
            settings.TagExpression = _clientTestRunConfiguration.TagFilter;
            settings.LogProviders.Add(new ServerHandlingLogProvider());
            foreach (var assembly in _loadedXapData.TestAssemblies)
            {
                settings.TestAssemblies.Add(assembly);
            }
            settings.TestHarness.TestHarnessCompleted += CurrentHarness_TestHarnessCompleted;
            return(settings);
        }
Exemplo n.º 22
0
 /// <summary>
 /// Initializes a new instance of the App class.
 /// </summary>
 public App()
 {
     Startup += delegate
     {
         UnitTestSettings settings = UnitTestSystem.CreateDefaultSettings();
         settings.SampleTags = new System.Collections.Generic.List <string>
         {
             "All",
             "WrapPanelTest",
             "WrapPanelTest-DP",
             "WrapPanelTest+DockPanelTest",
             "(WrapPanelTest+DockPanelTest)-DP",
             "WrapPanelTest*DP",
             "!DP",
         };
         RootVisual = UnitTestSystem.CreateTestPage(settings);
     };
     InitializeComponent();
 }
        /// <summary>
        /// Run the unit tests.
        /// </summary>
        private void RunTests()
        {
            // Update the history
            string tag = txtTag.Text;

            TagHistory.Remove(tag);
            TagHistory.Insert(0, tag);
            while (TagHistory.Count > 5)
            {
                TagHistory.RemoveAt(5);
            }
            IsolatedStorageSettings.SiteSettings[TagHistoryKey] = TagHistory;

            // Launch Ignite with the test tag
            UnitTestSettings settings = UnitTestSystem.CreateDefaultSettings();

            settings.TagExpression = tag;
            Root.Children.Clear();
            Root.Children.Add(UnitTestSystem.CreateTestPage(settings));
        }
Exemplo n.º 24
0
        private void Application_Startup(object sender, StartupEventArgs e)
        {
            var settings = UnitTestSystem.CreateDefaultSettings();

            //settings.StartRunImmediately = true;

            var testAssemblies = new string[]
            {
                "ObjectBuilder.Tests.Silverlight, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null",
                "Unity.Tests.Silverlight, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null",
                "Unity.Interception.Tests.Silverlight, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"
            };

            foreach (var assemblyName in testAssemblies)
            {
                settings.TestAssemblies.Add(Assembly.Load(assemblyName));
            }

            this.RootVisual = UnitTestSystem.CreateTestPage(settings);
        }
Exemplo n.º 25
0
        public static UIElement CreateTestPage()
        {
            UnitTestProvider.Register();

            var unitTestSettings = UnitTestSystem.CreateDefaultSettings();

            unitTestSettings.TestAssemblies.Clear();
            unitTestSettings.TestAssemblies.Add(typeof(xunit_silverlight.XunitFixesTests).Assembly);
            unitTestSettings.TestAssemblies.Add(typeof(xunit.extensions_silverlight.XunitFixesTests).Assembly);
            unitTestSettings.ShowTagExpressionEditor = true;
            unitTestSettings.SampleTags = new[] { "All", "XunitFixesTests", "SanityCheckTests" };

            foreach (var logProvider in unitTestSettings.LogProviders)
            {
                if (logProvider is DebugOutputProvider)
                {
                    ((DebugOutputProvider)logProvider).ShowEverything = true;
                }
            }

            return(UnitTestSystem.CreateTestPage(unitTestSettings));
        }
Exemplo n.º 26
0
        private void Application_Startup(object sender, StartupEventArgs e)
        {
            UnitTestSettings s = UnitTestSystem.CreateDefaultSettings();

            this.RootVisual = UnitTestSystem.CreateTestPage(s);
        }
Exemplo n.º 27
0
        private UnitTestSettings GetUnitTestSettings(IDictionary <string, string> initParams)
        {
            var    settings = UnitTestSystem.CreateDefaultSettings();
            string filter;

            if (!initParams.TryGetValue("AssemblyFilter", out filter))
            {
                filter = ".*";
            }

            string testFilter;

            HtmlPage.Document.QueryString.TryGetValue("testFilter", out testFilter);

            bool   runPerfTestsOnly = false;
            string runPerfTestsOnlyString;

            if (initParams.TryGetValue("RunPerfTestsOnly", out runPerfTestsOnlyString) && runPerfTestsOnlyString.Equals("true", StringComparison.OrdinalIgnoreCase))
            {
                runPerfTestsOnly = true;
            }

            bool   runFullTrustTestsOnly = false;
            string runFullTrustTestsOnlyString;

            if (initParams.TryGetValue("RunFullTrustTestsOnly", out runFullTrustTestsOnlyString) && runFullTrustTestsOnlyString.Equals("true", StringComparison.OrdinalIgnoreCase))
            {
                runFullTrustTestsOnly = true;
            }

            bool   runMediumTrustTestsOnly = false;
            string runMediumTrustTestsOnlyString;

            if (initParams.TryGetValue("RunMediumTrustTestsOnly", out runMediumTrustTestsOnlyString) && runMediumTrustTestsOnlyString.Equals("true", StringComparison.OrdinalIgnoreCase))
            {
                runMediumTrustTestsOnly = true;
            }

            foreach (var part in Deployment.Current.Parts)
            {
                if (Regex.IsMatch(part.Source, filter))
                {
                    var sr       = Application.GetResourceStream(new Uri(part.Source, UriKind.Relative));
                    var assembly = part.Load(sr.Stream);

                    settings.TestAssemblies.Add(assembly);
                }
            }

            if (!String.IsNullOrEmpty(testFilter))
            {
                settings.TestHarness = new RiaTestHarness(m => RunTest(m, testFilter));
            }
            else if (runPerfTestsOnly)
            {
                settings.TestHarness = new RiaTestHarness(m => IsPerfMethod(m));
            }
            else if (runFullTrustTestsOnly)
            {
                settings.TestHarness = new RiaTestHarness(m => IsFullTrustMethod(m));
            }
            else if (runMediumTrustTestsOnly)
            {
                settings.TestHarness = new RiaTestHarness(m => !IsFullTrustMethod(m));
            }

            return(settings);
        }