public void ExpectedExceptionAttributeRemover_RemovesSingleAttribute(string attributeLists) { var attributeRemover = new ExpectedExceptionAttributeRemover(); var(_, methodSyntax) = CompiledSourceFileProvider.CompileAttributeLists(attributeLists); var model = new Mock <IExpectedExceptionModel>(); model.Setup(m => m.GetAttributeSyntax()) .Returns( Task <SyntaxNode> .FromResult( methodSyntax.AttributeLists .SelectMany(list => list.Attributes).First(attr => attr.Name.ToString() == "ExpectedException"))); var rewritten = attributeRemover.Transform(methodSyntax, model.Object); Assert.That(rewritten.AttributeLists.ToString(), Is.EqualTo("[Test]")); }