Exemplo n.º 1
0
        public void Given_a_list_of_method_usages_it_filters_down_based_on_changed_methods_list()
        {
            ChangedMethod method = new ChangedMethod {
                                                         ClassName = "Class1", MethodName = "Method1"
                                                     };

            MethodUsage usage = new MethodUsage {ClassName = "Class1", MethodName = "Method1"};

            var expectedTestToExecuted = new Test{ClassName = "Class1Tests", MethodName = "Method1Tests"};
            usage.TestCoverage = new List<Test>();
            usage.TestCoverage.Add(expectedTestToExecuted);

            ChangedMethodsFilter filter = new ChangedMethodsFilter();
            IEnumerable<Test> testsToExecuted = filter.FindUnitTestsAffectedByChanges(new List<ChangedMethod> {method}, new List<MethodUsage> {usage});

            Assert.That(testsToExecuted.Count(), Is.EqualTo(1));
            Assert.IsTrue(testsToExecuted.Contains(expectedTestToExecuted));
        }
Exemplo n.º 2
0
        private TestExecutionResults ProcessNewlyBuiltAssembly()
        {
            AssemblyDiffer differ = new AssemblyDiffer();
            var findModifiedMethods = differ.FindModifiedMethods(oldAssembly, newAssembly);

            TestFinder finder = new TestFinder();
            var findUsagesViaTests = finder.FindUsagesViaTests(testAssembly);

            ChangedMethodsFilter filter = new ChangedMethodsFilter();
            var findUnitTestsAffectedByChanges = filter.FindUnitTestsAffectedByChanges(findModifiedMethods, findUsagesViaTests);

            GallioTestRunner runner = new GallioTestRunner();
            var testExecutionResults = runner.Execute(findUnitTestsAffectedByChanges);

            MoveAssemblyToOld(oldOutDir, outDir);

            return testExecutionResults;
        }