public void FilterMutants_should_filter_included_and_excluded_files( string[] patterns, string filePath, int spanStart, int spanEnd, bool shouldKeepFile) { // Arrange var options = new StrykerOptions(mutate: patterns); var file = new FileLeaf { RelativePath = filePath, FullPath = Path.Combine("C:/test/", filePath) }; // Create token with the correct text span var syntaxToken = SyntaxFactory.Identifier( new SyntaxTriviaList(Enumerable.Range(0, spanStart).Select(x => SyntaxFactory.Space)), new string('a', spanEnd - spanStart), SyntaxTriviaList.Empty); var mutant = new Mutant { Mutation = new Mutation { OriginalNode = SyntaxFactory.IdentifierName(syntaxToken) } }; var sut = new FilePatternMutantFilter(); // Act var result = sut.FilterMutants(new[] { mutant }, file.ToReadOnly(), options); // Assert result.Contains(mutant).ShouldBe(shouldKeepFile); }
public static void ShouldHaveName() { var target = new FilePatternMutantFilter() as IMutantFilter; target.DisplayName.ShouldBe("file filter"); }
public static void ShouldHaveName() { var target = new FilePatternMutantFilter(new StrykerOptions()) as IMutantFilter; target.DisplayName.ShouldBe("mutate filter"); }