private MethodDeclarationSyntax ProduceTestMethodForExceptionCluster( TestCaseExceptionEquivalenceCluster cluster, int clustersCount, TestMethodNamer testMethodNamer) { var testCasesToRemain = cluster.EquivalentItems.Select(i => i.AttributeNode).ToArray(); var exceptionExpectancy = cluster.EquivalentItems.First(); var clusterMethod = _method.WithoutExceptionExpectancyInAttributes(testCasesToRemain) .WithBody(CreateAssertedBlock(exceptionExpectancy)).WithTrailingTrivia(CreateClusterMethodTrailingTrivia(cluster)) .WithIdentifier(testMethodNamer.CreateName(exceptionExpectancy, clustersCount)); return(clusterMethod); }
private MethodDeclarationSyntax ProduceTestMethodForTestCaseWithExpectedExceptionEquivalence( ExpectedExceptionTestCaseEquivalence equivalence, int equivalenceCount, TestMethodNamer testMethodNamer) { var testCasesToRemain = equivalence.EquivalentItems.Select(i => i.AttributeNode).ToArray(); var exceptionExpectancy = equivalence.EquivalentItems.First(); var clusterMethod = methodToBeFixed.WithoutExceptionExpectancyInAttributes(testCasesToRemain) .WithBody(CreateAssertedBlock(exceptionExpectancy)).WithTrailingTrivia(CreateClusterMethodTrailingTrivia(equivalence)) .WithIdentifier(testMethodNamer.CreateName(exceptionExpectancy, equivalenceCount)); return(clusterMethod); }
private IEnumerable <MethodDeclarationSyntax> ProduceFixedTestMethods() { var fixedMethods = new List <MethodDeclarationSyntax>(); var testMethodNamer = new TestMethodNamer(methodToBeFixed, migrator.ExceptionFreeTestCaseAttributeNodes.Any()); if (TryProduceExceptionUnrelatedTestMethod(out MethodDeclarationSyntax fixedExceptionUnrelatedMethod)) { fixedMethods.Add(fixedExceptionUnrelatedMethod); } foreach (var equivalence in equivalences) { fixedMethods.Add(ProduceTestMethodForTestCaseWithExpectedExceptionEquivalence(equivalence, equivalences.Length, testMethodNamer)); } return(fixedMethods); }
private IEnumerable <MethodDeclarationSyntax> ProduceFixedTestMethods() { var fixedMethods = new List <MethodDeclarationSyntax>(); var testMethodNamer = new TestMethodNamer(_method, _model.ExceptionFreeTestCaseAttributeNodes.Any()); if (TryProduceExceptionUnrelatedTestMethod(out MethodDeclarationSyntax fixedExceptionUnrelatedMethod)) { fixedMethods.Add(fixedExceptionUnrelatedMethod); } foreach (var cluster in _clusters) { fixedMethods.Add(ProduceTestMethodForExceptionCluster(cluster, _clusters.Length, testMethodNamer)); } return(fixedMethods); }