예제 #1
0
        void TestRunCompletedCallback(object sender, TestHarnessCompletedEventArgs e)
        {
            int testsPassed = 0;
            int testsFailed = 0;
            int testsInconclusive = 0;
            UnitTestHarness testHarness = sender as UnitTestHarness;
            using (IsolatedStorageFile isoStore = IsolatedStorageFile.GetUserStoreForApplication())
            {
                using (IsolatedStorageFileStream stream = isoStore.OpenFile("pubnublog.txt", FileMode.OpenOrCreate))
                {
                    using (StreamWriter writer = new StreamWriter(stream))
                    {
                        foreach (ScenarioResult result in testHarness.Results)
                        {
                            writer.WriteLine(result.ToString());
                            System.Diagnostics.Debug.WriteLine(result.ToString());
                            switch (result.Result)
                            {
                                case TestOutcome.Passed:
                                case TestOutcome.Completed:
                                    testsPassed++;
                                    break;
                                case TestOutcome.Inconclusive:
                                    testsInconclusive++;
                                    break;
                                default:
                                    testsFailed++;
                                    // must be a failure of some kind
                                    // perform some outputting
                                    break;
                            }
                        }
                        writer.WriteLine("Total Tests = " + testHarness.Results.Count);
                        writer.WriteLine("Tests Passed = " + testsPassed);
                        writer.WriteLine("Tests Failed = " + testsFailed);
                        writer.WriteLine("Tests Inconclusive = " + testsInconclusive);

                        System.Diagnostics.Debug.WriteLine("Total Tests = " + testHarness.Results.Count);
                        System.Diagnostics.Debug.WriteLine("Tests Passed = " + testsPassed);
                        System.Diagnostics.Debug.WriteLine("Tests Failed = " + testsFailed);
                        System.Diagnostics.Debug.WriteLine("Tests Inconclusive = " + testsInconclusive);

                        writer.Close();
                    }
                    stream.Close();
                }
            }
        }
예제 #2
0
 /// <summary>
 /// Call the TestHarnessCompleted event.
 /// </summary>
 /// <param name="args">The test harness completed event arguments.</param>
 private void OnTestHarnessCompleted(TestHarnessCompletedEventArgs args)
 {
   var handler = TestHarnessCompleted;
   if (handler != null)
   {
     handler(this, args);
   }
 }
예제 #3
0
    /// <summary>
    /// Handles the test harness complete event, to display results.
    /// </summary>
    /// <param name="sender">The source object.</param>
    /// <param name="e">The event data.</param>
    private void OnTestHarnessCompleted(object sender, TestHarnessCompletedEventArgs e)
    {
      foreach (TestAssemblyData assembly in _model.Data.TestAssemblies)
      {
        assembly.UpdateCounts();
      }

      RunningTestPanel.Visibility = System.Windows.Visibility.Collapsed;
      RunningTestProgress.IsIndeterminate = false;

      _emailButton.IsEnabled = true;
      _saveButton.IsEnabled = true;
    }