Beispiel #1
0
        private async Task LoadTests(Mutant mutant)
        {
            _viewModel.TestNamespaces.Clear();

            if (mutant.MutantTestSession.IsComplete)
            {
                var namespaces = await Task.Run(() => _testsContainer.CreateMutantTestTree(mutant));

                _viewModel.TestNamespaces.AddRange(namespaces);
            }
            else
            {
                //_listenerForCurrentMutant = mutant.TestSession.WhenPropertyChanged(_ => _.IsComplete)
                //    .Subscribe(x => _viewModel.TestNamespaces.AddRange(mutant.TestSession.TestNamespaces));
            }
        }
 public XElement CreateDetailedTestingResults(List <Mutant> mutants, ProgressCounter progress, CancellationToken token)
 {
     return(new XElement("DetailedTestingResults",
                         from mutant in mutants
                         where mutant.MutantTestSession.IsComplete
                         let x = progressAction(progress, token)
                                 let namespaces = _testsContainer.CreateMutantTestTree(mutant)
                                                  let groupedTests = namespaces.GroupBy(m => m.State).ToList()
                                                                     select new XElement("TestedMutant",
                                                                                         new XAttribute("MutantId", mutant.Id),
                                                                                         new XAttribute("TestingTimeMiliseconds", mutant.MutantTestSession.TestingTimeMiliseconds),
                                                                                         new XElement("Tests",
                                                                                                      new XAttribute("NumberOfFailedTests", groupedTests.SingleOrDefault(g => g.Key == TestNodeState.Failure).ToEmptyIfNull().Count()),
                                                                                                      new XAttribute("NumberOfPassedTests", groupedTests.SingleOrDefault(g => g.Key == TestNodeState.Success).ToEmptyIfNull().Count()),
                                                                                                      new XAttribute("NumberOfInconlusiveTests", groupedTests.SingleOrDefault(g => g.Key == TestNodeState.Inconclusive).ToEmptyIfNull().Count()),
                                                                                                      from testClass in namespaces
                                                                                                      .Cast <CheckedNode>().SelectManyRecursive(n => n.Children ?? new NotifyingCollection <CheckedNode>()).OfType <TestNodeClass>()
                                                                                                      let xx = cancellationCheck(token)
                                                                                                               select new XElement("TestClass",
                                                                                                                                   new XAttribute("Name", testClass.Name),
                                                                                                                                   new XAttribute("FullName", testClass.FullName),
                                                                                                                                   from testMethod in testClass.Children.Cast <TestNodeMethod>()
                                                                                                                                   where testMethod.State == TestNodeState.Failure
                                                                                                                                   select new XElement("TestMethod",
                                                                                                                                                       new XAttribute("Name", testMethod.Name),
                                                                                                                                                       new XAttribute("Outcome", "Failed"),
                                                                                                                                                       new XElement("Message", testMethod.Message)),
                                                                                                                                   from testMethod in testClass.Children.Cast <TestNodeMethod>()
                                                                                                                                   where testMethod.State.IsIn(TestNodeState.Success, TestNodeState.Inconclusive)
                                                                                                                                   select new XElement("TestMethod",
                                                                                                                                                       new XAttribute("Name", testMethod.Name),
                                                                                                                                                       new XAttribute("Outcome", FunctionalExt.ValuedSwitch <TestNodeState, string>(testMethod.State)
                                                                                                                                                                      .Case(TestNodeState.Success, "Passed")
                                                                                                                                                                      .Case(TestNodeState.Inconclusive, "Inconclusive")
                                                                                                                                                                      .GetResult())
                                                                                                                                                       )
                                                                                                                                   )
                                                                                                      )
                                                                                         )
                         ));
 }