Microsoft.Silverlight.Testing.Harness.UnitTestHarness.Initialize C# (CSharp) Method

Initialize() public method

Initialize the harness with a set of test assemblies.
public Initialize ( ) : void
return void
        public virtual void Initialize()
        {
            Publishing += (sender, args) => ReportCodeCoverage(TestService);

            // Create the initial dispatcher tasks
            CreateHarnessTasks();

            if (Settings != null)
            {
                InitializeSettings(Settings);
            }

            // Attach to the unhandled exception handler
            InterceptAllExceptions = true;

            LogWriter.TestInfrastructure(Properties.UnitTestMessage.UnitTestHarness_Initialize_UnitTestHarnessInitialize);
            PrepareTestAssemblyTasks();
        }

Usage Example

Example #1
0
        private void Application_Startup(object sender, StartupEventArgs e)
        {
            var harness = new UnitTestHarness();
            var settings = new UnitTestSettings();
            settings.TestHarness = harness;
            harness.Settings = settings;
            harness.Initialize();

            harness.TestRunStarting += (senderx, ex) =>
                {
                    var provider = new TestProvider();
                    var filter = new TagTestRunFilter(settings, harness, settings.TagExpression);

                    var features = FeatureFactory.GetFeatures(typeof(App).Assembly);
                    foreach (var feature in features)
                    {
                        provider.RegisterFeature(feature);
                        var ass = provider.GetUnitTestAssembly(harness, feature.Assembly);
                        harness.EnqueueTestAssembly(ass, filter);
                    }
                };

            this.RootVisual = UnitTestSystem.CreateTestPage(settings);
        }