From 8959d444ee8ad1578fc57769dc2f2e4b8074e465 Mon Sep 17 00:00:00 2001 From: Meir Blachman Date: Wed, 13 Dec 2023 11:29:49 +0200 Subject: [PATCH] better visibility for mstest discovery (#253) --- .../TestAttributes.cs | 162 ++++++++--------- .../Tips/AsyncVoidTests.cs | 2 +- .../Tips/CollectionTests.cs | 118 ++++++------ .../Tips/DictionaryTests.cs | 24 +-- .../Tips/ExceptionsTests.cs | 16 +- .../Tips/MsTestTests.cs | 172 +++++++++--------- .../Tips/NullConditionalAssertionTests.cs | 4 +- .../Tips/NumericTests.cs | 16 +- .../Tips/StringTests.cs | 28 +-- 9 files changed, 262 insertions(+), 280 deletions(-) diff --git a/src/FluentAssertions.Analyzers.Tests/TestAttributes.cs b/src/FluentAssertions.Analyzers.Tests/TestAttributes.cs index 805dd2a9..5b238528 100644 --- a/src/FluentAssertions.Analyzers.Tests/TestAttributes.cs +++ b/src/FluentAssertions.Analyzers.Tests/TestAttributes.cs @@ -1,117 +1,99 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; using System; using System.Collections.Generic; -using System.Linq; +using System.Reflection; -namespace FluentAssertions.Analyzers.Tests +namespace FluentAssertions.Analyzers.Tests; + +[AttributeUsage(AttributeTargets.Method)] +public class NotImplementedAttribute : TestCategoryBaseAttribute { - [AttributeUsage(AttributeTargets.Method)] - public class NotImplementedAttribute : TestCategoryBaseAttribute - { - public string Reason { get; set; } - - public override IList TestCategories => new[] { "NotImplemented" }; - } + public string Reason { get; set; } - [AttributeUsage(AttributeTargets.Method)] - public class ImplementedAttribute : TestCategoryBaseAttribute - { - public string Reason { get; set; } + public override IList TestCategories => new[] { "NotImplemented" }; +} - public override IList TestCategories => new[] { "Completed" }; - } +[AttributeUsage(AttributeTargets.Method)] +public class ImplementedAttribute : TestCategoryBaseAttribute +{ + public string Reason { get; set; } - [AttributeUsage(AttributeTargets.Method, AllowMultiple = true)] - public class AssertionDiagnosticAttribute : Attribute - { - public string Assertion { get; } + public override IList TestCategories => new[] { "Completed" }; +} - public bool Ignore { get; } +[AttributeUsage(AttributeTargets.Method, AllowMultiple = true)] +public class AssertionDiagnosticAttribute : Attribute, ITestDataSource +{ + public string Assertion { get; } - public AssertionDiagnosticAttribute(string assertion, bool ignore = false) - { - Assertion = assertion; - Ignore = ignore; - } - } + public bool Ignore { get; } - [AttributeUsage(AttributeTargets.Method, AllowMultiple = true)] - public class AssertionCodeFixAttribute : Attribute - { - public string OldAssertion { get; } - public string NewAssertion { get; } + public AssertionDiagnosticAttribute(string assertion, bool ignore = false) => (Assertion, Ignore) = (assertion, ignore); - public bool Ignore { get; } + public IEnumerable GetData(MethodInfo methodInfo) + { + if (Ignore) yield break; - public AssertionCodeFixAttribute(string oldAssertion, string newAssertion, bool ignore = false) + foreach (var assertion in TestCasesInputUtils.GetTestCases(Assertion)) { - OldAssertion = oldAssertion; - NewAssertion = newAssertion; - Ignore = ignore; + yield return new object[] { assertion }; } } - [AttributeUsage(AttributeTargets.Method)] - public class AssertionDataTestMethod : TestMethodAttribute + public string GetDisplayName(MethodInfo methodInfo, object[] data) => $"{methodInfo.Name}(\"{data[0]}\")"; +} + +[AttributeUsage(AttributeTargets.Method, AllowMultiple = true)] +public class AssertionCodeFixAttribute : Attribute, ITestDataSource +{ + public string OldAssertion { get; } + public string NewAssertion { get; } + + public bool Ignore { get; } + + public AssertionCodeFixAttribute(string oldAssertion, string newAssertion, bool ignore = false) => (OldAssertion, NewAssertion, Ignore) = (oldAssertion, newAssertion, ignore); + + public IEnumerable GetData(MethodInfo methodInfo) { - private static readonly string Empty = string.Empty; - private static readonly string Because = "\"because it's possible\""; - private static readonly string FormattedBecause = "\"because message with {0} placeholders {1} at {2}\", 3, \"is awesome\", DateTime.Now.Add(2.Seconds())"; + if (Ignore) yield break; - public override TestResult[] Execute(ITestMethod testMethod) + foreach (var (oldAssertion, newAssertion) in TestCasesInputUtils.GetTestCases(OldAssertion, NewAssertion)) { - var diagnosticAttributes = testMethod.GetAttributes(false); - var codeFixAttributes = testMethod.GetAttributes(false); - - var results = new List(); - foreach (var diagnosticAttribute in diagnosticAttributes.Where(attribute => !attribute.Ignore)) - { - foreach (var assertion in GetTestCases(diagnosticAttribute)) - { - var result = testMethod.Invoke(new[] { assertion }); - result.DisplayName = $"{testMethod.TestMethodName} (\"{assertion}\")"; - - results.Add(result); - } - } - foreach (var codeFixAttribute in codeFixAttributes.Where(attribute => !attribute.Ignore)) - { - foreach (var (oldAssertion, newAssertion) in GetTestCases(codeFixAttribute)) - { - var result = testMethod.Invoke(new[] { oldAssertion, newAssertion }); - result.DisplayName = $"{testMethod.TestMethodName} ({Environment.NewLine}old: \"{oldAssertion}\" {Environment.NewLine}new: \"{newAssertion}\")"; - - results.Add(result); - } - } - - return results.ToArray(); + yield return new object[] { oldAssertion, newAssertion }; } + } - private IEnumerable GetTestCases(AssertionDiagnosticAttribute attribute) - { - yield return SafeFormat(attribute.Assertion, Empty); - yield return SafeFormat(attribute.Assertion, Because); - yield return SafeFormat(attribute.Assertion, FormattedBecause); - } - private IEnumerable<(string oldAssertion, string newAssertion)> GetTestCases(AssertionCodeFixAttribute attribute) - { - yield return (SafeFormat(attribute.OldAssertion, Empty), SafeFormat(attribute.NewAssertion, Empty)); - yield return (SafeFormat(attribute.OldAssertion, Because), SafeFormat(attribute.NewAssertion, Because)); - yield return (SafeFormat(attribute.OldAssertion, FormattedBecause), SafeFormat(attribute.NewAssertion, FormattedBecause)); - } + public string GetDisplayName(MethodInfo methodInfo, object[] data) => $"{methodInfo.Name}(\"old: {data[0]}\", new: {data[1]}\")"; +} + +public static class TestCasesInputUtils +{ + private static readonly string Empty = string.Empty; + private static readonly string Because = "\"because it's possible\""; + private static readonly string FormattedBecause = "\"because message with {0} placeholders {1} at {2}\", 3, \"is awesome\", DateTime.Now.Add(2.Seconds())"; + public static IEnumerable GetTestCases(string assertion) + { + yield return SafeFormat(assertion, Empty); + yield return SafeFormat(assertion, Because); + yield return SafeFormat(assertion, FormattedBecause); + } + public static IEnumerable<(string oldAssertion, string newAssertion)> GetTestCases(string oldAssertion, string newAssertion) + { + yield return (SafeFormat(oldAssertion, Empty), SafeFormat(newAssertion, Empty)); + yield return (SafeFormat(oldAssertion, Because), SafeFormat(newAssertion, Because)); + yield return (SafeFormat(oldAssertion, FormattedBecause), SafeFormat(newAssertion, FormattedBecause)); + } - /// - /// Adds an comma before the additional argument if needed. - /// - private string SafeFormat(string assertion, string arg) + /// + /// Adds an comma before the additional argument if needed. + /// + private static string SafeFormat(string assertion, string arg) + { + var index = assertion.IndexOf("{0}"); + if (!string.IsNullOrEmpty(arg) && assertion[index - 1] != '(') { - var index = assertion.IndexOf("{0}"); - if (!string.IsNullOrEmpty(arg) && assertion[index - 1] != '(') - { - return string.Format(assertion, ", " + arg); - } - return string.Format(assertion, arg); + return string.Format(assertion, ", " + arg); } + return string.Format(assertion, arg); } } diff --git a/src/FluentAssertions.Analyzers.Tests/Tips/AsyncVoidTests.cs b/src/FluentAssertions.Analyzers.Tests/Tips/AsyncVoidTests.cs index ef772c63..59907a10 100644 --- a/src/FluentAssertions.Analyzers.Tests/Tips/AsyncVoidTests.cs +++ b/src/FluentAssertions.Analyzers.Tests/Tips/AsyncVoidTests.cs @@ -55,7 +55,7 @@ public void AssignAsyncVoidLambdaToAction_TestAnalyzer(string assertion) [AssertionCodeFix( oldAssertion: "Action action1 = async () => { await Task.CompletedTask; }, action2 = async () => { await Task.CompletedTask; };", newAssertion: "Func action1 = async () => { await Task.CompletedTask; }, action2 = async () => { await Task.CompletedTask; };")] - [AssertionDataTestMethod] + [DataTestMethod] [NotImplemented] public void AssignAsyncVoidLambdaToAction_TestCodeFix(string oldAssertion, string newAssertion) { diff --git a/src/FluentAssertions.Analyzers.Tests/Tips/CollectionTests.cs b/src/FluentAssertions.Analyzers.Tests/Tips/CollectionTests.cs index 477c2c1c..e0c06da3 100644 --- a/src/FluentAssertions.Analyzers.Tests/Tips/CollectionTests.cs +++ b/src/FluentAssertions.Analyzers.Tests/Tips/CollectionTests.cs @@ -7,13 +7,13 @@ namespace FluentAssertions.Analyzers.Tests [TestClass] public class CollectionTests { - [AssertionDataTestMethod] + [DataTestMethod] [AssertionDiagnostic("actual.Any().Should().BeTrue({0});")] [AssertionDiagnostic("actual.AsEnumerable().Any().Should().BeTrue({0}).And.ToString();")] [Implemented] public void ExpressionBodyAssertion_TestAnalyzer(string assertion) => VerifyCSharpDiagnosticExpressionBody(assertion); - [AssertionDataTestMethod] + [DataTestMethod] [AssertionCodeFix( oldAssertion: "actual.Any().Should().BeTrue({0});", newAssertion: "actual.Should().NotBeEmpty({0});")] @@ -23,13 +23,13 @@ public class CollectionTests [Implemented] public void ExpressionBodyAssertion_TestCodeFix(string oldAssertion, string newAssertion) => VerifyCSharpFixExpressionBody(oldAssertion, newAssertion); - [AssertionDataTestMethod] + [DataTestMethod] [AssertionDiagnostic("actual.Any().Should().BeTrue({0});")] [AssertionDiagnostic("actual.AsEnumerable().Any().Should().BeTrue({0}).And.ToString();")] [Implemented] public void CollectionsShouldNotBeEmpty_TestAnalyzer(string assertion) => VerifyCSharpDiagnosticCodeBlock(assertion); - [AssertionDataTestMethod] + [DataTestMethod] [AssertionCodeFix( oldAssertion: "actual.Any().Should().BeTrue({0});", newAssertion: "actual.Should().NotBeEmpty({0});")] @@ -39,13 +39,13 @@ public class CollectionTests [Implemented] public void CollectionsShouldNotBeEmpty_TestCodeFix(string oldAssertion, string newAssertion) => VerifyCSharpFixCodeBlock(oldAssertion, newAssertion); - [AssertionDataTestMethod] + [DataTestMethod] [AssertionDiagnostic("actual.Any().Should().BeTrue({0});")] [AssertionDiagnostic("actual.AsEnumerable().Any().Should().BeTrue({0}).And.ToString();")] [Implemented] public void CollectionsShouldNotBeEmpty_Array_TestAnalyzer(string assertion) => VerifyArrayCSharpDiagnosticCodeBlock(assertion); - [AssertionDataTestMethod] + [DataTestMethod] [AssertionCodeFix( oldAssertion: "actual.Any().Should().BeTrue({0});", newAssertion: "actual.Should().NotBeEmpty({0});")] @@ -55,7 +55,7 @@ public class CollectionTests [Implemented] public void CollectionsShouldNotBeEmpty_Array_TestCodeFix(string oldAssertion, string newAssertion) => VerifyArrayCSharpFixCodeBlock(oldAssertion, newAssertion); - [AssertionDataTestMethod] + [DataTestMethod] [AssertionDiagnostic("actual.Any().Should().BeFalse({0});")] [AssertionDiagnostic("actual.Should().HaveCount(0{0});")] [AssertionDiagnostic("actual.AsEnumerable().Any().Should().BeFalse({0}).And.ToString();")] @@ -63,7 +63,7 @@ public class CollectionTests [Implemented] public void CollectionsShouldBeEmpty_TestAnalyzer(string assertion) => VerifyCSharpDiagnosticCodeBlock(assertion); - [AssertionDataTestMethod] + [DataTestMethod] [AssertionCodeFix( oldAssertion: "actual.Any().Should().BeFalse({0});", newAssertion: "actual.Should().BeEmpty({0});")] @@ -79,7 +79,7 @@ public class CollectionTests [Implemented] public void CollectionsShouldBeEmpty_TestCodeFix(string oldAssertion, string newAssertion) => VerifyCSharpFixCodeBlock(oldAssertion, newAssertion); - [AssertionDataTestMethod] + [DataTestMethod] [AssertionDiagnostic("actual.Any(x => x.BooleanProperty).Should().BeTrue({0});")] [AssertionDiagnostic("actual.Where(x => x.BooleanProperty).Should().NotBeEmpty({0});")] [AssertionDiagnostic("actual.AsEnumerable().Any(x => x.BooleanProperty).Should().BeTrue({0}).And.ToString();")] @@ -87,7 +87,7 @@ public class CollectionTests [Implemented] public void CollectionShouldContainProperty_TestAnalyzer(string assertion) => VerifyCSharpDiagnosticCodeBlock(assertion); - [AssertionDataTestMethod] + [DataTestMethod] [AssertionCodeFix( oldAssertion: "actual.Any(x => x.BooleanProperty).Should().BeTrue({0});", newAssertion: "actual.Should().Contain(x => x.BooleanProperty{0});")] @@ -103,7 +103,7 @@ public class CollectionTests [Implemented] public void CollectionShouldContainProperty_TestCodeFix(string oldAssertion, string newAssertion) => VerifyCSharpFixCodeBlock(oldAssertion, newAssertion); - [AssertionDataTestMethod] + [DataTestMethod] [AssertionDiagnostic("actual.Any(x => x.BooleanProperty).Should().BeFalse({0});")] [AssertionDiagnostic("actual.Where(x => x.BooleanProperty).Should().BeEmpty({0});")] [AssertionDiagnostic("actual.Should().OnlyContain(x => !x.BooleanProperty{0});", ignore: true)] @@ -113,7 +113,7 @@ public class CollectionTests [Implemented] public void CollectionShouldNotContainProperty_TestAnalyzer(string assertion) => VerifyCSharpDiagnosticCodeBlock(assertion); - [AssertionDataTestMethod] + [DataTestMethod] [AssertionCodeFix( oldAssertion: "actual.Any(x => x.BooleanProperty).Should().BeFalse({0});", newAssertion: "actual.Should().NotContain(x => x.BooleanProperty{0});")] @@ -137,13 +137,13 @@ public class CollectionTests [Implemented] public void CollectionShouldNotContainProperty_TestCodeFix(string oldAssertion, string newAssertion) => VerifyCSharpFixCodeBlock(oldAssertion, newAssertion); - [AssertionDataTestMethod] + [DataTestMethod] [AssertionDiagnostic("actual.All(x => x.BooleanProperty).Should().BeTrue({0});")] [AssertionDiagnostic("actual.AsEnumerable().All(x => x.BooleanProperty).Should().BeTrue({0}).And.ToString();")] [Implemented] public void CollectionShouldOnlyContainProperty_TestAnalyzer(string assertion) => VerifyCSharpDiagnosticCodeBlock(assertion); - [AssertionDataTestMethod] + [DataTestMethod] [AssertionCodeFix( oldAssertion: "actual.All(x => x.BooleanProperty).Should().BeTrue({0});", newAssertion: "actual.Should().OnlyContain(x => x.BooleanProperty{0});")] @@ -153,13 +153,13 @@ public class CollectionTests [Implemented] public void CollectionShouldOnlyContainProperty_TestCodeFix(string oldAssertion, string newAssertion) => VerifyCSharpFixCodeBlock(oldAssertion, newAssertion); - [AssertionDataTestMethod] + [DataTestMethod] [AssertionDiagnostic("actual.Contains(expectedItem).Should().BeTrue({0});")] [AssertionDiagnostic("actual.AsEnumerable().Contains(expectedItem).Should().BeTrue({0}).And.ToString();")] [Implemented] public void CollectionShouldContainItem_TestAnalyzer(string assertion) => VerifyCSharpDiagnosticCodeBlock(assertion); - [AssertionDataTestMethod] + [DataTestMethod] [AssertionCodeFix( oldAssertion: "actual.Contains(expectedItem).Should().BeTrue({0});", newAssertion: "actual.Should().Contain(expectedItem{0});")] @@ -169,13 +169,13 @@ public class CollectionTests [Implemented] public void CollectionShouldContainItem_TestCodeFix(string oldAssertion, string newAssertion) => VerifyCSharpFixCodeBlock(oldAssertion, newAssertion); - [AssertionDataTestMethod] + [DataTestMethod] [AssertionDiagnostic("actual.Contains(unexpectedItem).Should().BeFalse({0});")] [AssertionDiagnostic("actual.AsEnumerable().Contains(unexpectedItem).Should().BeFalse({0}).And.ToString();")] [Implemented] public void CollectionShouldNotContainItem_TestAnalyzer(string assertion) => VerifyCSharpDiagnosticCodeBlock(assertion); - [AssertionDataTestMethod] + [DataTestMethod] [AssertionCodeFix( oldAssertion: "actual.Contains(unexpectedItem).Should().BeFalse({0});", newAssertion: "actual.Should().NotContain(unexpectedItem{0});")] @@ -185,7 +185,7 @@ public class CollectionTests [Implemented] public void CollectionShouldNotContainItem_TestCodeFix(string oldAssertion, string newAssertion) => VerifyCSharpFixCodeBlock(oldAssertion, newAssertion); - [AssertionDataTestMethod] + [DataTestMethod] [AssertionDiagnostic("actual.Count().Should().Be(k{0});")] [AssertionDiagnostic("actual.Count().Should().Be(6{0});")] [AssertionDiagnostic("actual.ToArray().Length.Should().Be(k{0});")] @@ -197,7 +197,7 @@ public class CollectionTests [Implemented] public void CollectionShouldHaveCount_TestAnalyzer(string assertion) => VerifyCSharpDiagnosticCodeBlock(assertion); - [AssertionDataTestMethod] + [DataTestMethod] [AssertionCodeFix( oldAssertion: "actual.Count().Should().Be(k{0});", newAssertion: "actual.Should().HaveCount(k{0});")] @@ -234,7 +234,7 @@ public class CollectionTests [Implemented] public void CollectionShouldHaveCount_TestCodeFix(string oldAssertion, string newAssertion) => VerifyCSharpFixCodeBlock(oldAssertion, newAssertion); - [AssertionDataTestMethod] + [DataTestMethod] [AssertionDiagnostic("actual.Count().Should().BeGreaterThan(k{0});")] [AssertionDiagnostic("actual.Count().Should().BeGreaterThan(6{0});")] [AssertionDiagnostic("actual.AsEnumerable().Count().Should().BeGreaterThan(k{0}).And.ToString();")] @@ -242,7 +242,7 @@ public class CollectionTests [Implemented] public void CollectionShouldHaveCountGreaterThan_TestAnalyzer(string assertion) => VerifyCSharpDiagnosticCodeBlock(assertion); - [AssertionDataTestMethod] + [DataTestMethod] [AssertionCodeFix( oldAssertion: "actual.Count().Should().BeGreaterThan(k{0});", newAssertion: "actual.Should().HaveCountGreaterThan(k{0});")] @@ -258,7 +258,7 @@ public class CollectionTests [Implemented] public void CollectionShouldHaveCountGreaterThan_TestCodeFix(string oldAssertion, string newAssertion) => VerifyCSharpFixCodeBlock(oldAssertion, newAssertion); - [AssertionDataTestMethod] + [DataTestMethod] [AssertionDiagnostic("actual.Count().Should().BeGreaterOrEqualTo(k{0});")] [AssertionDiagnostic("actual.Count().Should().BeGreaterOrEqualTo(6{0});")] [AssertionDiagnostic("actual.AsEnumerable().Count().Should().BeGreaterOrEqualTo(k{0}).And.ToString();")] @@ -266,7 +266,7 @@ public class CollectionTests [Implemented] public void CollectionShouldHaveCountGreaterOrEqualTo_TestAnalyzer(string assertion) => VerifyCSharpDiagnosticCodeBlock(assertion); - [AssertionDataTestMethod] + [DataTestMethod] [AssertionCodeFix( oldAssertion: "actual.Count().Should().BeGreaterOrEqualTo(k{0});", newAssertion: "actual.Should().HaveCountGreaterOrEqualTo(k{0});")] @@ -282,7 +282,7 @@ public class CollectionTests [Implemented] public void CollectionShouldHaveCountGreaterOrEqualTo_TestCodeFix(string oldAssertion, string newAssertion) => VerifyCSharpFixCodeBlock(oldAssertion, newAssertion); - [AssertionDataTestMethod] + [DataTestMethod] [AssertionDiagnostic("actual.Count().Should().BeLessThan(k{0});")] [AssertionDiagnostic("actual.Count().Should().BeLessThan(6{0});")] [AssertionDiagnostic("actual.AsEnumerable().Count().Should().BeLessThan(k{0}).And.ToString();")] @@ -290,7 +290,7 @@ public class CollectionTests [Implemented] public void CollectionShouldHaveCountLessThan_TestAnalyzer(string assertion) => VerifyCSharpDiagnosticCodeBlock(assertion); - [AssertionDataTestMethod] + [DataTestMethod] [AssertionCodeFix( oldAssertion: "actual.Count().Should().BeLessThan(k{0});", newAssertion: "actual.Should().HaveCountLessThan(k{0});")] @@ -306,7 +306,7 @@ public class CollectionTests [Implemented] public void CollectionShouldHaveCountLessThan_TestCodeFix(string oldAssertion, string newAssertion) => VerifyCSharpFixCodeBlock(oldAssertion, newAssertion); - [AssertionDataTestMethod] + [DataTestMethod] [AssertionDiagnostic("actual.Count().Should().BeLessOrEqualTo(k{0});")] [AssertionDiagnostic("actual.Count().Should().BeLessOrEqualTo(6{0});")] [AssertionDiagnostic("actual.AsEnumerable().Count().Should().BeLessOrEqualTo(k{0}).And.ToString();")] @@ -314,7 +314,7 @@ public class CollectionTests [Implemented] public void CollectionShouldHaveCountLessOrEqualTo_TestAnalyzer(string assertion) => VerifyCSharpDiagnosticCodeBlock(assertion); - [AssertionDataTestMethod] + [DataTestMethod] [AssertionCodeFix( oldAssertion: "actual.Count().Should().BeLessOrEqualTo(k{0});", newAssertion: "actual.Should().HaveCountLessOrEqualTo(k{0});")] @@ -330,7 +330,7 @@ public class CollectionTests [Implemented] public void CollectionShouldHaveCountLessOrEqualTo_TestCodeFix(string oldAssertion, string newAssertion) => VerifyCSharpFixCodeBlock(oldAssertion, newAssertion); - [AssertionDataTestMethod] + [DataTestMethod] [AssertionDiagnostic("actual.Count().Should().NotBe(k{0});")] [AssertionDiagnostic("actual.Count().Should().NotBe(6{0});")] [AssertionDiagnostic("actual.AsEnumerable().Count().Should().NotBe(k{0}).And.ToString();")] @@ -338,7 +338,7 @@ public class CollectionTests [Implemented] public void CollectionShouldNotHaveCount_TestAnalyzer(string assertion) => VerifyCSharpDiagnosticCodeBlock(assertion); - [AssertionDataTestMethod] + [DataTestMethod] [AssertionCodeFix( oldAssertion: "actual.Count().Should().NotBe(k{0});", newAssertion: "actual.Should().NotHaveCount(k{0});")] @@ -354,13 +354,13 @@ public class CollectionTests [Implemented] public void CollectionShouldNotHaveCount_TestCodeFix(string oldAssertion, string newAssertion) => VerifyCSharpFixCodeBlock(oldAssertion, newAssertion); - [AssertionDataTestMethod] + [DataTestMethod] [AssertionDiagnostic("actual.Should().HaveCount(expected.Count(){0});")] [AssertionDiagnostic("actual.AsEnumerable().Should().HaveCount(expected.Count(){0}).And.ToString();")] [Implemented] public void CollectionShouldHaveSameCount_TestAnalyzer(string assertion) => VerifyCSharpDiagnosticCodeBlock(assertion); - [AssertionDataTestMethod] + [DataTestMethod] [AssertionCodeFix( oldAssertion: "actual.Should().HaveCount(expected.Count(){0});", newAssertion: "actual.Should().HaveSameCount(expected{0});")] @@ -370,13 +370,13 @@ public class CollectionTests [Implemented] public void CollectionShouldHaveSameCount_TestCodeFix(string oldAssertion, string newAssertion) => VerifyCSharpFixCodeBlock(oldAssertion, newAssertion); - [AssertionDataTestMethod] + [DataTestMethod] [AssertionDiagnostic("actual.Count().Should().NotBe(unexpected.Count(){0});")] [AssertionDiagnostic("actual.AsEnumerable().Count().Should().NotBe(unexpected.Count(){0}).And.ToString();")] [Implemented] public void CollectionShouldNotHaveSameCount_TestAnalyzer(string assertion) => VerifyCSharpDiagnosticCodeBlock(assertion); - [AssertionDataTestMethod] + [DataTestMethod] [AssertionCodeFix( oldAssertion: "actual.Count().Should().NotBe(unexpected.Count(){0});", newAssertion: "actual.Should().NotHaveSameCount(unexpected{0});")] @@ -386,7 +386,7 @@ public class CollectionTests [Implemented] public void CollectionShouldNotHaveSameCount_TestCodeFix(string oldAssertion, string newAssertion) => VerifyCSharpFixCodeBlock(oldAssertion, newAssertion); - [AssertionDataTestMethod] + [DataTestMethod] [AssertionDiagnostic("actual.Should().HaveCount(1{0});")] [Implemented] public void CollectionShouldContainSingle_TestAnalyzer_GenericIEnumerableShouldReport(string assertion) @@ -405,7 +405,7 @@ public void CollectionShouldContainSingle_TestAnalyzer_GenericIEnumerableShouldR }); } - [AssertionDataTestMethod] + [DataTestMethod] [AssertionDiagnostic("actual.Should().HaveCount(1{0});")] [AssertionDiagnostic("actual.Where(x => x.BooleanProperty).Should().HaveCount(1{0});")] [AssertionDiagnostic("actual.AsEnumerable().Should().HaveCount(1{0}).And.ToString();")] @@ -413,7 +413,7 @@ public void CollectionShouldContainSingle_TestAnalyzer_GenericIEnumerableShouldR [Implemented] public void CollectionShouldContainSingle_TestAnalyzer(string assertion) => VerifyCSharpDiagnosticCodeBlock(assertion); - [AssertionDataTestMethod] + [DataTestMethod] [AssertionCodeFix( oldAssertion: "actual.Where(x => x.BooleanProperty).Should().HaveCount(1{0});", newAssertion: "actual.Should().ContainSingle(x => x.BooleanProperty{0});")] @@ -429,7 +429,7 @@ public void CollectionShouldContainSingle_TestAnalyzer_GenericIEnumerableShouldR [Implemented] public void CollectionShouldContainSingle_TestCodeFix(string oldAssertion, string newAssertion) => VerifyCSharpFixCodeBlock(oldAssertion, newAssertion); - [AssertionDataTestMethod] + [DataTestMethod] [AssertionDiagnostic("actual.Should().NotBeNull().And.NotBeEmpty({0});")] [AssertionDiagnostic("actual.Should().NotBeEmpty().And.NotBeNull({0});")] [AssertionDiagnostic("actual.AsEnumerable().Should().NotBeNull().And.NotBeEmpty({0}).And.ToString();")] @@ -437,7 +437,7 @@ public void CollectionShouldContainSingle_TestAnalyzer_GenericIEnumerableShouldR [Implemented] public void CollectionShouldNotBeNullOrEmpty_TestAnalyzer(string assertion) => VerifyCSharpDiagnosticCodeBlock(assertion); - [AssertionDataTestMethod] + [DataTestMethod] [AssertionCodeFix( oldAssertion: "actual.Should().NotBeNull().And.NotBeEmpty({0});", newAssertion: "actual.Should().NotBeNullOrEmpty({0});")] @@ -453,7 +453,7 @@ public void CollectionShouldContainSingle_TestAnalyzer_GenericIEnumerableShouldR [Implemented] public void CollectionShouldNotBeNullOrEmpty_TestCodeFix(string oldAssertion, string newAssertion) => VerifyCSharpFixCodeBlock(oldAssertion, newAssertion); - [AssertionDataTestMethod] + [DataTestMethod] [AssertionDiagnostic("actual.ElementAt(k).Should().Be(expectedItem{0});")] [AssertionDiagnostic("actual.ElementAt(6).Should().Be(expectedItem{0});")] [AssertionDiagnostic("actual[k].Should().Be(expectedItem{0});")] @@ -469,7 +469,7 @@ public void CollectionShouldContainSingle_TestAnalyzer_GenericIEnumerableShouldR [Implemented] public void CollectionShouldHaveElementAt_TestAnalyzer(string assertion) => VerifyCSharpDiagnosticCodeBlock(assertion); - [AssertionDataTestMethod] + [DataTestMethod] [AssertionCodeFix( oldAssertion: "actual.ElementAt(k).Should().Be(expectedItem{0});", newAssertion: "actual.Should().HaveElementAt(k, expectedItem{0});")] @@ -509,13 +509,13 @@ public void CollectionShouldContainSingle_TestAnalyzer_GenericIEnumerableShouldR [Implemented] public void CollectionShouldHaveElementAt_TestCodeFix(string oldAssertion, string newAssertion) => VerifyCSharpFixCodeBlock(oldAssertion, newAssertion); - [AssertionDataTestMethod] + [DataTestMethod] [AssertionDiagnostic("actual.OrderBy(x => x.BooleanProperty).Should().Equal(actual{0});")] [AssertionDiagnostic("actual.AsEnumerable().OrderBy(x => x.BooleanProperty).Should().Equal(actual{0}).And.ToString();")] [Implemented] public void CollectionShouldBeInAscendingOrder_TestAnalyzer(string assertion) => VerifyCSharpDiagnosticCodeBlock(assertion); - [AssertionDataTestMethod] + [DataTestMethod] [AssertionCodeFix( oldAssertion: "actual.OrderBy(x => x.BooleanProperty).Should().Equal(actual{0});", newAssertion: "actual.Should().BeInAscendingOrder(x => x.BooleanProperty{0});")] @@ -525,13 +525,13 @@ public void CollectionShouldContainSingle_TestAnalyzer_GenericIEnumerableShouldR [Implemented] public void CollectionShouldBeInAscendingOrder_TestCodeFix(string oldAssertion, string newAssertion) => VerifyCSharpFixCodeBlock(oldAssertion, newAssertion); - [AssertionDataTestMethod] + [DataTestMethod] [AssertionDiagnostic("actual.OrderByDescending(x => x.BooleanProperty).Should().Equal(actual{0});")] [AssertionDiagnostic("actual.AsEnumerable().OrderByDescending(x => x.BooleanProperty).Should().Equal(actual{0}).And.ToString();")] [Implemented] public void CollectionShouldBeInDescendingOrder_TestAnalyzer(string assertion) => VerifyCSharpDiagnosticCodeBlock(assertion); - [AssertionDataTestMethod] + [DataTestMethod] [AssertionCodeFix( oldAssertion: "actual.OrderByDescending(x => x.BooleanProperty).Should().Equal(actual{0});", newAssertion: "actual.Should().BeInDescendingOrder(x => x.BooleanProperty{0});")] @@ -541,13 +541,13 @@ public void CollectionShouldContainSingle_TestAnalyzer_GenericIEnumerableShouldR [Implemented] public void CollectionShouldBeInDescendingOrder_TestCodeFix(string oldAssertion, string newAssertion) => VerifyCSharpFixCodeBlock(oldAssertion, newAssertion); - [AssertionDataTestMethod] + [DataTestMethod] [AssertionDiagnostic("actual.Select(e1 => e1.BooleanProperty).Should().Equal(expected.Select(e2 => e2.BooleanProperty){0});")] [AssertionDiagnostic("actual.AsEnumerable().Select(e1 => e1.BooleanProperty).Should().Equal(expected.Select(e2 => e2.BooleanProperty){0}).And.ToString();")] [Implemented] public void CollectionShouldEqualOtherCollectionByComparer_TestAnalyzer(string assertion) => VerifyCSharpDiagnosticCodeBlock(assertion); - [AssertionDataTestMethod] + [DataTestMethod] [AssertionCodeFix( oldAssertion: "actual.Select(e1 => e1.BooleanProperty).Should().Equal(expected.Select(e2 => e2.BooleanProperty){0});", newAssertion: "actual.Should().Equal(expected, (e1, e2) => e1.BooleanProperty == e2.BooleanProperty{0});")] @@ -557,13 +557,13 @@ public void CollectionShouldContainSingle_TestAnalyzer_GenericIEnumerableShouldR [Implemented] public void CollectionShouldEqualOtherCollectionByComparer_TestCodeFix(string oldAssertion, string newAssertion) => VerifyCSharpFixCodeBlock(oldAssertion, newAssertion); - [AssertionDataTestMethod] + [DataTestMethod] [AssertionDiagnostic("actual.Intersect(expected).Should().BeEmpty({0});")] [AssertionDiagnostic("actual.AsEnumerable().Intersect(expected).Should().BeEmpty({0}).And.ToString();")] [Implemented] public void CollectionShouldNotIntersectWith_TestAnalyzer(string assertion) => VerifyCSharpDiagnosticCodeBlock(assertion); - [AssertionDataTestMethod] + [DataTestMethod] [AssertionCodeFix( oldAssertion: "actual.Intersect(expected).Should().BeEmpty({0});", newAssertion: "actual.Should().NotIntersectWith(expected{0});")] @@ -573,13 +573,13 @@ public void CollectionShouldContainSingle_TestAnalyzer_GenericIEnumerableShouldR [Implemented] public void CollectionShouldNotIntersectWith_TestCodeFix(string oldAssertion, string newAssertion) => VerifyCSharpFixCodeBlock(oldAssertion, newAssertion); - [AssertionDataTestMethod] + [DataTestMethod] [AssertionDiagnostic("actual.Intersect(expected).Should().NotBeEmpty({0});")] [AssertionDiagnostic("actual.AsEnumerable().Intersect(expected).Should().NotBeEmpty({0}).And.ToString();")] [Implemented] public void CollectionShouldIntersectWith_TestAnalyzer(string assertion) => VerifyCSharpDiagnosticCodeBlock(assertion); - [AssertionDataTestMethod] + [DataTestMethod] [AssertionCodeFix( oldAssertion: "actual.Intersect(expected).Should().NotBeEmpty({0});", newAssertion: "actual.Should().IntersectWith(expected{0});")] @@ -589,13 +589,13 @@ public void CollectionShouldContainSingle_TestAnalyzer_GenericIEnumerableShouldR [Implemented] public void CollectionShouldIntersectWith_TestCodeFix(string oldAssertion, string newAssertion) => VerifyCSharpFixCodeBlock(oldAssertion, newAssertion); - [AssertionDataTestMethod] + [DataTestMethod] [AssertionDiagnostic("actual.Select(x => x.BooleanProperty).Should().NotContainNulls({0});")] [AssertionDiagnostic("actual.AsEnumerable().Select(x => x.BooleanProperty).Should().NotContainNulls({0}).And.ToString();")] [Implemented] public void CollectionShouldNotContainNulls_TestAnalyzer(string assertion) => VerifyCSharpDiagnosticCodeBlock(assertion); - [AssertionDataTestMethod] + [DataTestMethod] [AssertionCodeFix( oldAssertion: "actual.Select(x => x.BooleanProperty).Should().NotContainNulls({0});", newAssertion: "actual.Should().NotContainNulls(x => x.BooleanProperty{0});")] @@ -606,13 +606,13 @@ public void CollectionShouldContainSingle_TestAnalyzer_GenericIEnumerableShouldR [Ignore("What Should Happen?")] public void CollectionShouldNotContainNulls_TestCodeFix(string oldAssertion, string newAssertion) => VerifyCSharpFixCodeBlock(oldAssertion, newAssertion); - [AssertionDataTestMethod] + [DataTestMethod] [AssertionDiagnostic("actual.Should().HaveSameCount(actual.Distinct(){0});")] [AssertionDiagnostic("actual.AsEnumerable().Should().HaveSameCount(actual.AsEnumerable().Distinct(){0}).And.ToString();")] [Implemented] public void CollectionShouldOnlyHaveUniqueItems_TestAnalyzer(string assertion) => VerifyCSharpDiagnosticCodeBlock(assertion); - [AssertionDataTestMethod] + [DataTestMethod] [AssertionCodeFix( oldAssertion: "actual.Should().HaveSameCount(actual.Distinct(){0});", newAssertion: "actual.Should().OnlyHaveUniqueItems({0});")] @@ -622,13 +622,13 @@ public void CollectionShouldContainSingle_TestAnalyzer_GenericIEnumerableShouldR [Implemented] public void CollectionShouldOnlyHaveUniqueItems_TestCodeFix(string oldAssertion, string newAssertion) => VerifyCSharpFixCodeBlock(oldAssertion, newAssertion); - [AssertionDataTestMethod] + [DataTestMethod] [AssertionDiagnostic("actual.Select(x => x.BooleanProperty).Should().OnlyHaveUniqueItems({0});")] [AssertionDiagnostic("actual.AsEnumerable().Select(x => x.BooleanProperty).Should().OnlyHaveUniqueItems({0}).And.ToString();")] [Implemented] public void CollectionShouldOnlyHaveUniqueItemsByComparer_TestAnalyzer(string assertion) => VerifyCSharpDiagnosticCodeBlock(assertion); - [AssertionDataTestMethod] + [DataTestMethod] [AssertionCodeFix( oldAssertion: "actual.Select(x => x.BooleanProperty).Should().OnlyHaveUniqueItems({0});", newAssertion: "actual.Should().OnlyHaveUniqueItems(x => x.BooleanProperty{0});")] @@ -638,14 +638,14 @@ public void CollectionShouldContainSingle_TestAnalyzer_GenericIEnumerableShouldR newAssertion: "actual.AsEnumerable().Should().OnlyHaveUniqueItems(x => x.BooleanProperty{0}).And.ToString();")] public void CollectionShouldOnlyHaveUniqueItemsByComparer_TestCodeFix(string oldAssertion, string newAssertion) => VerifyCSharpFixCodeBlock(oldAssertion, newAssertion); - [AssertionDataTestMethod] + [DataTestMethod] [AssertionDiagnostic("actual.FirstOrDefault().Should().BeNull({0});")] [NotImplemented] [AssertionDiagnostic("actual.AsEnumerable().FirstOrDefault().Should().BeNull({0}).And.ToString();")] [Ignore("What Should Happen?")] public void CollectionShouldHaveElementAt0Null_TestAnalyzer(string assertion) => VerifyCSharpDiagnosticCodeBlock(assertion); - [AssertionDataTestMethod] + [DataTestMethod] [AssertionCodeFix( oldAssertion: "actual.FirstOrDefault().Should().BeNull({0});", newAssertion: "actual.Should().HaveElementAt(0, null{0});")] diff --git a/src/FluentAssertions.Analyzers.Tests/Tips/DictionaryTests.cs b/src/FluentAssertions.Analyzers.Tests/Tips/DictionaryTests.cs index 3e9607c1..1c6868e2 100644 --- a/src/FluentAssertions.Analyzers.Tests/Tips/DictionaryTests.cs +++ b/src/FluentAssertions.Analyzers.Tests/Tips/DictionaryTests.cs @@ -7,13 +7,13 @@ namespace FluentAssertions.Analyzers.Tests [TestClass] public class DictionaryTests { - [AssertionDataTestMethod] + [DataTestMethod] [AssertionDiagnostic("actual.ContainsKey(expectedKey).Should().BeTrue({0});")] [AssertionDiagnostic("actual.ToDictionary(p => p.Key, p=> p.Value).ContainsKey(expectedKey).Should().BeTrue({0}).And.ToString();")] [Implemented] public void DictionaryShouldContainKey_TestAnalyzer(string assertion) => VerifyCSharpDiagnostic(assertion); - [AssertionDataTestMethod] + [DataTestMethod] [AssertionCodeFix( oldAssertion: "actual.ContainsKey(expectedKey).Should().BeTrue({0});", newAssertion: "actual.Should().ContainKey(expectedKey{0});")] @@ -23,13 +23,13 @@ public class DictionaryTests [Implemented] public void DictionaryShouldContainKey_TestCodeFix(string oldAssertion, string newAssertion) => VerifyCSharpFix(oldAssertion, newAssertion); - [AssertionDataTestMethod] + [DataTestMethod] [AssertionDiagnostic("actual.ContainsKey(expectedKey).Should().BeFalse({0});")] [AssertionDiagnostic("actual.ToDictionary(p => p.Key, p=> p.Value).ContainsKey(expectedKey).Should().BeFalse({0}).And.ToString();")] [Implemented] public void DictionaryShouldNotContainKey_TestAnalyzer(string assertion) => VerifyCSharpDiagnostic(assertion); - [AssertionDataTestMethod] + [DataTestMethod] [AssertionCodeFix( oldAssertion: "actual.ContainsKey(expectedKey).Should().BeFalse({0});", newAssertion: "actual.Should().NotContainKey(expectedKey{0});")] @@ -39,13 +39,13 @@ public class DictionaryTests [Implemented] public void DictionaryShouldNotContainKey_TestCodeFix(string oldAssertion, string newAssertion) => VerifyCSharpFix(oldAssertion, newAssertion); - [AssertionDataTestMethod] + [DataTestMethod] [AssertionDiagnostic("actual.ContainsValue(expectedValue).Should().BeTrue({0});")] [AssertionDiagnostic("actual.ToDictionary(p => p.Key, p=> p.Value).ContainsValue(expectedValue).Should().BeTrue({0}).And.ToString();")] [Implemented] public void DictionaryShouldContainValue_TestAnalyzer(string assertion) => VerifyCSharpDiagnostic(assertion); - [AssertionDataTestMethod] + [DataTestMethod] [AssertionCodeFix( oldAssertion: "actual.ContainsValue(expectedValue).Should().BeTrue({0});", newAssertion: "actual.Should().ContainValue(expectedValue{0});")] @@ -55,13 +55,13 @@ public class DictionaryTests [Implemented] public void DictionaryShouldContainValue_TestCodeFix(string oldAssertion, string newAssertion) => VerifyCSharpFix(oldAssertion, newAssertion); - [AssertionDataTestMethod] + [DataTestMethod] [AssertionDiagnostic("actual.ContainsValue(expectedValue).Should().BeFalse({0});")] [AssertionDiagnostic("actual.ToDictionary(p => p.Key, p=> p.Value).ContainsValue(expectedValue).Should().BeFalse({0}).And.ToString();")] [Implemented] public void DictionaryShouldNotContainValue_TestAnalyzer(string assertion) => VerifyCSharpDiagnostic(assertion); - [AssertionDataTestMethod] + [DataTestMethod] [AssertionCodeFix( oldAssertion: "actual.ContainsValue(expectedValue).Should().BeFalse({0});", newAssertion: "actual.Should().NotContainValue(expectedValue{0});")] @@ -71,7 +71,7 @@ public class DictionaryTests [Implemented] public void DictionaryShouldNotContainValue_TestCodeFix(string oldAssertion, string newAssertion) => VerifyCSharpFix(oldAssertion, newAssertion); - [AssertionDataTestMethod] + [DataTestMethod] [AssertionDiagnostic("actual.Should().ContainKey(expectedKey{0}).And.ContainValue(expectedValue);")] [AssertionDiagnostic("actual.Should().ContainKey(expectedKey).And.ContainValue(expectedValue{0});")] [AssertionDiagnostic("actual.ToDictionary(p => p.Key, p=> p.Value).Should().ContainKey(expectedKey{0}).And.ContainValue(expectedValue).And.ToString();")] @@ -83,7 +83,7 @@ public class DictionaryTests [Implemented] public void DictionaryShouldContainKeyAndValue_TestAnalyzer(string assertion) => VerifyCSharpDiagnostic(assertion); - [AssertionDataTestMethod] + [DataTestMethod] [AssertionCodeFix( oldAssertion: "actual.Should().ContainKey(expectedKey{0}).And.ContainValue(expectedValue);", newAssertion: "actual.Should().Contain(expectedKey, expectedValue{0});")] @@ -111,7 +111,7 @@ public class DictionaryTests [Implemented] public void DictionaryShouldContainKeyAndValue_TestCodeFix(string oldAssertion, string newAssertion) => VerifyCSharpFix(oldAssertion, newAssertion); - [AssertionDataTestMethod] + [DataTestMethod] [AssertionDiagnostic("actual.Should().ContainKey(pair.Key{0}).And.ContainValue(pair.Value);")] [AssertionDiagnostic("actual.Should().ContainKey(pair.Key).And.ContainValue(pair.Value{0});")] [AssertionDiagnostic("actual.Should().ContainValue(pair.Value{0}).And.ContainKey(pair.Key);")] @@ -123,7 +123,7 @@ public class DictionaryTests [Implemented] public void DictionaryShouldContainPair_TestAnalyzer(string assertion) => VerifyCSharpDiagnostic(assertion); - [AssertionDataTestMethod] + [DataTestMethod] [AssertionCodeFix( oldAssertion: "actual.Should().ContainKey(pair.Key{0}).And.ContainValue(pair.Value);", newAssertion: "actual.Should().Contain(pair{0});")] diff --git a/src/FluentAssertions.Analyzers.Tests/Tips/ExceptionsTests.cs b/src/FluentAssertions.Analyzers.Tests/Tips/ExceptionsTests.cs index f360c30f..6bc427f8 100644 --- a/src/FluentAssertions.Analyzers.Tests/Tips/ExceptionsTests.cs +++ b/src/FluentAssertions.Analyzers.Tests/Tips/ExceptionsTests.cs @@ -7,7 +7,7 @@ namespace FluentAssertions.Analyzers.Tests [TestClass] public class ExceptionsTests { - [AssertionDataTestMethod] + [DataTestMethod] [AssertionDiagnostic("action.Should().Throw().Which.Message.Should().Contain(expectedMessage{0});")] [AssertionDiagnostic("action.Should().Throw().And.Message.Should().Contain(expectedMessage{0});")] [AssertionDiagnostic("action.Should().Throw().Which.Message.Should().Contain(\"a constant string\"{0});")] @@ -27,7 +27,7 @@ public class ExceptionsTests [Implemented] public void ExceptionShouldThrowWithMessage_TestAnalyzer(string assertion) => VerifyCSharpDiagnostic(assertion); - [AssertionDataTestMethod] + [DataTestMethod] [AssertionCodeFix( oldAssertion: "action.Should().Throw().Which.Message.Should().Contain(expectedMessage{0});", newAssertion: "action.Should().Throw().WithMessage($\"*{{expectedMessage}}*\"{0});")] @@ -79,7 +79,7 @@ public class ExceptionsTests [Implemented] public void ExceptionShouldThrowWithMessage_TestCodeFix(string oldAssertion, string newAssertion) => VerifyCSharpFix(oldAssertion, newAssertion); - [AssertionDataTestMethod] + [DataTestMethod] [AssertionDiagnostic("action.Should().ThrowExactly().And.Message.Should().Contain(expectedMessage{0});")] [AssertionDiagnostic("action.Should().ThrowExactly().Which.Message.Should().Contain(expectedMessage{0});")] [AssertionDiagnostic("action.Should().ThrowExactly().Which.Message.Should().Contain(\"a constant string\"{0});")] @@ -99,7 +99,7 @@ public class ExceptionsTests [Implemented] public void ExceptionShouldThrowExactlyWithMessage_TestAnalyzer(string assertion) => VerifyCSharpDiagnostic(assertion); - [AssertionDataTestMethod] + [DataTestMethod] [AssertionCodeFix( oldAssertion: "action.Should().ThrowExactly().Which.Message.Should().Contain(expectedMessage{0});", newAssertion: "action.Should().ThrowExactly().WithMessage($\"*{{expectedMessage}}*\"{0});")] @@ -151,7 +151,7 @@ public class ExceptionsTests [Implemented] public void ExceptionShouldThrowExactlyWithMessage_TestCodeFix(string oldAssertion, string newAssertion) => VerifyCSharpFix(oldAssertion, newAssertion); - [AssertionDataTestMethod] + [DataTestMethod] [AssertionDiagnostic("action.Should().Throw().And.InnerException.Should().BeOfType({0});")] [AssertionDiagnostic("action.Should().Throw().Which.InnerException.Should().BeOfType({0});")] [AssertionDiagnostic("action.Should().ThrowExactly().And.InnerException.Should().BeOfType({0});")] @@ -159,7 +159,7 @@ public class ExceptionsTests [Implemented] public void ExceptionShouldThrowWithInnerExceptionExactly_TestAnalyzer(string assertion) => VerifyCSharpDiagnostic(assertion); - [AssertionDataTestMethod] + [DataTestMethod] [AssertionCodeFix( oldAssertion: "action.Should().Throw().And.InnerException.Should().BeOfType({0});", newAssertion: "action.Should().Throw().WithInnerExceptionExactly({0});")] @@ -175,7 +175,7 @@ public class ExceptionsTests [Implemented] public void ExceptionShouldThrowWithInnerExceptionExactly_TestCodeFix(string oldAssertion, string newAssertion) => VerifyCSharpFix(oldAssertion, newAssertion); - [AssertionDataTestMethod] + [DataTestMethod] [AssertionDiagnostic("action.Should().ThrowExactly().And.InnerException.Should().BeAssignableTo({0});")] [AssertionDiagnostic("action.Should().ThrowExactly().Which.InnerException.Should().BeAssignableTo({0});")] [AssertionDiagnostic("action.Should().Throw().And.InnerException.Should().BeAssignableTo({0});")] @@ -183,7 +183,7 @@ public class ExceptionsTests [Implemented] public void ExceptionShouldThrowWithInnerException_TestAnalyzer(string assertion) => VerifyCSharpDiagnostic(assertion); - [AssertionDataTestMethod] + [DataTestMethod] [AssertionCodeFix( oldAssertion: "action.Should().Throw().And.InnerException.Should().BeAssignableTo({0});", newAssertion: "action.Should().Throw().WithInnerException({0});")] diff --git a/src/FluentAssertions.Analyzers.Tests/Tips/MsTestTests.cs b/src/FluentAssertions.Analyzers.Tests/Tips/MsTestTests.cs index 2dd57670..5f6ce874 100644 --- a/src/FluentAssertions.Analyzers.Tests/Tips/MsTestTests.cs +++ b/src/FluentAssertions.Analyzers.Tests/Tips/MsTestTests.cs @@ -12,13 +12,13 @@ namespace FluentAssertions.Analyzers.Tests.Tips [TestClass] public class MsTestTests { - [AssertionDataTestMethod] + [DataTestMethod] [AssertionDiagnostic("Assert.IsTrue(actual{0});")] [AssertionDiagnostic("Assert.IsTrue(bool.Parse(\"true\"){0});")] [Implemented] public void AssertIsTrue_TestAnalyzer(string assertion) => VerifyCSharpDiagnostic("bool actual", assertion); - [AssertionDataTestMethod] + [DataTestMethod] [AssertionDiagnostic("Assert.IsTrue(actual{0});")] [AssertionDiagnostic("Assert.IsTrue(bool.Parse(\"true\"){0});")] [Implemented] @@ -42,7 +42,7 @@ public void AssertIsTrue_NestedUsingInNamespace1_TestAnalyzer(string assertion) .AppendLine("}") .ToString()); - [AssertionDataTestMethod] + [DataTestMethod] [AssertionDiagnostic("Assert.IsTrue(actual{0});")] [AssertionDiagnostic("Assert.IsTrue(bool.Parse(\"true\"){0});")] [Implemented] @@ -66,7 +66,7 @@ public void AssertIsTrue_NestedUsingInNamespace2_TestAnalyzer(string assertion) .AppendLine("}") .ToString()); - [AssertionDataTestMethod] + [DataTestMethod] [AssertionDiagnostic("Assert.IsTrue(actual{0});")] [AssertionDiagnostic("Assert.IsTrue(bool.Parse(\"true\"){0});")] [Implemented] @@ -90,7 +90,7 @@ public void AssertIsTrue_NestedUsingInNamespace3_TestAnalyzer(string assertion) .AppendLine("}") .ToString()); - [AssertionDataTestMethod] + [DataTestMethod] [AssertionDiagnostic("Assert.IsTrue(actual{0});")] [AssertionDiagnostic("Assert.IsTrue(bool.Parse(\"true\"){0});")] [Implemented] @@ -114,7 +114,7 @@ public void AssertIsTrue_NestedUsingInNamespace4_TestAnalyzer(string assertion) .AppendLine("}") .ToString()); - [AssertionDataTestMethod] + [DataTestMethod] [AssertionDiagnostic("Assert.IsTrue(actual{0});")] [AssertionDiagnostic("Assert.IsTrue(bool.Parse(\"true\"){0});")] [Implemented] @@ -138,7 +138,7 @@ public void AssertIsTrue_NestedUsingInNamespace5_TestAnalyzer(string assertion) .AppendLine("}") .ToString()); - [AssertionDataTestMethod] + [DataTestMethod] [AssertionDiagnostic("Assert.IsTrue(actual{0});")] [AssertionDiagnostic("Assert.IsTrue(bool.Parse(\"true\"){0});")] [Implemented] @@ -162,7 +162,7 @@ public void AssertIsTrue_NestedUsingInNamespace6_TestAnalyzer(string assertion) .AppendLine("}") .ToString()); - [AssertionDataTestMethod] + [DataTestMethod] [AssertionDiagnostic("Assert.IsTrue(actual{0});")] [AssertionDiagnostic("Assert.IsTrue(bool.Parse(\"true\"){0});")] [Implemented] @@ -186,7 +186,7 @@ public void AssertIsTrue_NestedUsingInNamespace7_TestAnalyzer(string assertion) .AppendLine("}") .ToString()); - [AssertionDataTestMethod] + [DataTestMethod] [AssertionDiagnostic("Assert.IsTrue(actual{0});")] [AssertionDiagnostic("Assert.IsTrue(bool.Parse(\"true\"){0});")] [Implemented] @@ -210,7 +210,7 @@ public void AssertIsTrue_NestedUsingInNamespace8_TestAnalyzer(string assertion) .AppendLine("}") .ToString()); - [AssertionDataTestMethod] + [DataTestMethod] [AssertionCodeFix( oldAssertion: "Assert.IsTrue(actual{0});", newAssertion: "actual.Should().BeTrue({0});")] @@ -221,13 +221,13 @@ public void AssertIsTrue_NestedUsingInNamespace8_TestAnalyzer(string assertion) public void AssertIsTrue_TestCodeFix(string oldAssertion, string newAssertion) => VerifyCSharpFix("bool actual", oldAssertion, newAssertion); - [AssertionDataTestMethod] + [DataTestMethod] [AssertionDiagnostic("Assert.IsFalse(actual{0});")] [AssertionDiagnostic("Assert.IsFalse(bool.Parse(\"true\"){0});")] [Implemented] public void AssertIsFalse_TestAnalyzer(string assertion) => VerifyCSharpDiagnostic("bool actual", assertion); - [AssertionDataTestMethod] + [DataTestMethod] [AssertionCodeFix( oldAssertion: "Assert.IsFalse(actual{0});", newAssertion: "actual.Should().BeFalse({0});")] @@ -238,12 +238,12 @@ public void AssertIsTrue_TestCodeFix(string oldAssertion, string newAssertion) public void AssertIsFalse_TestCodeFix(string oldAssertion, string newAssertion) => VerifyCSharpFix("bool actual", oldAssertion, newAssertion); - [AssertionDataTestMethod] + [DataTestMethod] [AssertionDiagnostic("Assert.IsNull(actual{0});")] [Implemented] public void AssertIsNull_TestAnalyzer(string assertion) => VerifyCSharpDiagnostic("object actual", assertion); - [AssertionDataTestMethod] + [DataTestMethod] [AssertionCodeFix( oldAssertion: "Assert.IsNull(actual{0});", newAssertion: "actual.Should().BeNull({0});")] @@ -251,12 +251,12 @@ public void AssertIsFalse_TestCodeFix(string oldAssertion, string newAssertion) public void AssertIsNull_TestCodeFix(string oldAssertion, string newAssertion) => VerifyCSharpFix("object actual", oldAssertion, newAssertion); - [AssertionDataTestMethod] + [DataTestMethod] [AssertionDiagnostic("Assert.IsNotNull(actual{0});")] [Implemented] public void AssertIsNotNull_TestAnalyzer(string assertion) => VerifyCSharpDiagnostic("object actual", assertion); - [AssertionDataTestMethod] + [DataTestMethod] [AssertionCodeFix( oldAssertion: "Assert.IsNotNull(actual{0});", newAssertion: "actual.Should().NotBeNull({0});")] @@ -264,14 +264,14 @@ public void AssertIsNull_TestCodeFix(string oldAssertion, string newAssertion) public void AssertIsNotNull_TestCodeFix(string oldAssertion, string newAssertion) => VerifyCSharpFix("object actual", oldAssertion, newAssertion); - [AssertionDataTestMethod] + [DataTestMethod] [AssertionDiagnostic("Assert.IsInstanceOfType(actual, type{0});")] [AssertionDiagnostic("Assert.IsInstanceOfType(actual, typeof(string){0});")] [AssertionDiagnostic("Assert.IsInstanceOfType(actual{0});")] [Implemented] public void AssertIsInstanceOfType_TestAnalyzer(string assertion) => VerifyCSharpDiagnostic("object actual, Type type", assertion); - [AssertionDataTestMethod] + [DataTestMethod] [AssertionCodeFix( oldAssertion: "Assert.IsInstanceOfType(actual, type{0});", newAssertion: "actual.Should().BeOfType(type{0});")] @@ -285,13 +285,13 @@ public void AssertIsNotNull_TestCodeFix(string oldAssertion, string newAssertion public void AssertIsInstanceOfType_TestCodeFix(string oldAssertion, string newAssertion) => VerifyCSharpFix("object actual, Type type", oldAssertion, newAssertion); - [AssertionDataTestMethod] + [DataTestMethod] [AssertionDiagnostic("Assert.IsNotInstanceOfType(actual, type{0});")] [AssertionDiagnostic("Assert.IsNotInstanceOfType(actual, typeof(string){0});")] [Implemented] public void AssertIsNotInstanceOfType_TestAnalyzer(string assertion) => VerifyCSharpDiagnostic("object actual, Type type", assertion); - [AssertionDataTestMethod] + [DataTestMethod] [AssertionCodeFix( oldAssertion: "Assert.IsNotInstanceOfType(actual, type{0});", newAssertion: "actual.Should().NotBeOfType(type{0});")] @@ -302,12 +302,12 @@ public void AssertIsInstanceOfType_TestCodeFix(string oldAssertion, string newAs public void AssertIsNotInstanceOfType_TestCodeFix(string oldAssertion, string newAssertion) => VerifyCSharpFix("object actual, Type type", oldAssertion, newAssertion); - [AssertionDataTestMethod] + [DataTestMethod] [AssertionDiagnostic("Assert.AreEqual(expected, actual{0});")] [Implemented] public void AssertObjectAreEqual_TestAnalyzer(string assertion) => VerifyCSharpDiagnostic("object actual, object expected", assertion); - [AssertionDataTestMethod] + [DataTestMethod] [AssertionCodeFix( oldAssertion: "Assert.AreEqual(expected, actual{0});", newAssertion: "actual.Should().Be(expected{0});")] @@ -315,12 +315,12 @@ public void AssertIsNotInstanceOfType_TestCodeFix(string oldAssertion, string ne public void AssertObjectAreEqual_TestCodeFix(string oldAssertion, string newAssertion) => VerifyCSharpFix("object actual, object expected", oldAssertion, newAssertion); - [AssertionDataTestMethod] + [DataTestMethod] [AssertionDiagnostic("Assert.AreEqual(expected, actual{0});")] [Implemented] public void AssertOptionalIntAreEqual_TestAnalyzer(string assertion) => VerifyCSharpDiagnostic("int? actual, int? expected", assertion); - [AssertionDataTestMethod] + [DataTestMethod] [AssertionCodeFix( oldAssertion: "Assert.AreEqual(expected, actual{0});", newAssertion: "actual.Should().Be(expected{0});")] @@ -328,12 +328,12 @@ public void AssertObjectAreEqual_TestCodeFix(string oldAssertion, string newAsse public void AssertOptionalIntAreEqual_TestCodeFix(string oldAssertion, string newAssertion) => VerifyCSharpFix("int? actual, int? expected", oldAssertion, newAssertion); - [AssertionDataTestMethod] + [DataTestMethod] [AssertionDiagnostic("Assert.AreEqual(actual, null{0});")] [Implemented] public void AssertOptionalIntAndNullAreEqual1_TestAnalyzer(string assertion) => VerifyCSharpDiagnostic("int? actual", assertion); - [AssertionDataTestMethod] + [DataTestMethod] [AssertionCodeFix( oldAssertion: "Assert.AreEqual(actual, null{0});", newAssertion: "actual.Should().BeNull({0});")] @@ -341,12 +341,12 @@ public void AssertOptionalIntAreEqual_TestCodeFix(string oldAssertion, string ne public void AssertOptionalIntAndNullAreEqual1_TestCodeFix(string oldAssertion, string newAssertion) => VerifyCSharpFix("int? actual", oldAssertion, newAssertion); - [AssertionDataTestMethod] + [DataTestMethod] [AssertionDiagnostic("Assert.AreEqual(null, actual{0});")] [Implemented] public void AssertOptionalIntAndNullAreEqual2_TestAnalyzer(string assertion) => VerifyCSharpDiagnostic("int? actual", assertion); - [AssertionDataTestMethod] + [DataTestMethod] [AssertionCodeFix( oldAssertion: "Assert.AreEqual(null, actual{0});", newAssertion: "actual.Should().BeNull({0});")] @@ -354,13 +354,13 @@ public void AssertOptionalIntAndNullAreEqual1_TestCodeFix(string oldAssertion, s public void AssertOptionalIntAndNullAreEqual2_TestCodeFix(string oldAssertion, string newAssertion) => VerifyCSharpFix("int? actual", oldAssertion, newAssertion); - [AssertionDataTestMethod] + [DataTestMethod] [AssertionDiagnostic("Assert.AreEqual(expected, actual, delta{0});")] [AssertionDiagnostic("Assert.AreEqual(expected, actual, 0.6{0});")] [Implemented] public void AssertDoubleAreEqual_TestAnalyzer(string assertion) => VerifyCSharpDiagnostic("double actual, double expected, double delta", assertion); - [AssertionDataTestMethod] + [DataTestMethod] [AssertionCodeFix( oldAssertion: "Assert.AreEqual(expected, actual, delta{0});", newAssertion: "actual.Should().BeApproximately(expected, delta{0});")] @@ -371,13 +371,13 @@ public void AssertOptionalIntAndNullAreEqual2_TestCodeFix(string oldAssertion, s public void AssertDoubleAreEqual_TestCodeFix(string oldAssertion, string newAssertion) => VerifyCSharpFix("double actual, double expected, double delta", oldAssertion, newAssertion); - [AssertionDataTestMethod] + [DataTestMethod] [AssertionDiagnostic("Assert.AreEqual(expected, actual, delta{0});")] [AssertionDiagnostic("Assert.AreEqual(expected, actual, 0.6f{0});")] [Implemented] public void AssertFloatAreEqual_TestAnalyzer(string assertion) => VerifyCSharpDiagnostic("float actual, float expected, float delta", assertion); - [AssertionDataTestMethod] + [DataTestMethod] [AssertionCodeFix( oldAssertion: "Assert.AreEqual(expected, actual, delta{0});", newAssertion: "actual.Should().BeApproximately(expected, delta{0});")] @@ -388,7 +388,7 @@ public void AssertDoubleAreEqual_TestCodeFix(string oldAssertion, string newAsse public void AssertFloatAreEqual_TestCodeFix(string oldAssertion, string newAssertion) => VerifyCSharpFix("float actual, float expected, float delta", oldAssertion, newAssertion); - [AssertionDataTestMethod] + [DataTestMethod] [AssertionDiagnostic("Assert.AreEqual(expected, actual{0});")] [AssertionDiagnostic("Assert.AreEqual(expected, actual, false{0});")] [AssertionDiagnostic("Assert.AreEqual(expected, actual, true{0});")] @@ -397,7 +397,7 @@ public void AssertFloatAreEqual_TestCodeFix(string oldAssertion, string newAsser [Implemented] public void AssertStringAreEqual_TestAnalyzer(string assertion) => VerifyCSharpDiagnostic("string actual, string expected", assertion); - [AssertionDataTestMethod] + [DataTestMethod] [AssertionCodeFix( oldAssertion: "Assert.AreEqual(expected, actual{0});", newAssertion: "actual.Should().Be(expected{0});")] @@ -417,12 +417,12 @@ public void AssertFloatAreEqual_TestCodeFix(string oldAssertion, string newAsser public void AssertStringAreEqual_TestCodeFix(string oldAssertion, string newAssertion) => VerifyCSharpFix("string actual, string expected", oldAssertion, newAssertion); - [AssertionDataTestMethod] + [DataTestMethod] [AssertionDiagnostic("Assert.AreNotEqual(expected, actual{0});")] [Implemented] public void AssertObjectAreNotEqual_TestAnalyzer(string assertion) => VerifyCSharpDiagnostic("object actual, object expected", assertion); - [AssertionDataTestMethod] + [DataTestMethod] [AssertionCodeFix( oldAssertion: "Assert.AreNotEqual(expected, actual{0});", newAssertion: "actual.Should().NotBe(expected{0});")] @@ -430,13 +430,13 @@ public void AssertStringAreEqual_TestCodeFix(string oldAssertion, string newAsse public void AssertObjectAreNotEqual_TestCodeFix(string oldAssertion, string newAssertion) => VerifyCSharpFix("object actual, object expected", oldAssertion, newAssertion); - [AssertionDataTestMethod] + [DataTestMethod] [AssertionDiagnostic("Assert.AreNotEqual(expected, actual, delta{0});")] [AssertionDiagnostic("Assert.AreNotEqual(expected, actual, 0.6{0});")] [Implemented] public void AssertDoubleAreNotEqual_TestAnalyzer(string assertion) => VerifyCSharpDiagnostic("double actual, double expected, double delta", assertion); - [AssertionDataTestMethod] + [DataTestMethod] [AssertionCodeFix( oldAssertion: "Assert.AreNotEqual(expected, actual, delta{0});", newAssertion: "actual.Should().NotBeApproximately(expected, delta{0});")] @@ -448,12 +448,12 @@ public void AssertDoubleAreNotEqual_TestCodeFix(string oldAssertion, string newA => VerifyCSharpFix("double actual, double expected, double delta", oldAssertion, newAssertion); - [AssertionDataTestMethod] + [DataTestMethod] [AssertionDiagnostic("Assert.AreNotEqual(expected, actual{0});")] [Implemented] public void AssertOptionalIntAreNotEqual_TestAnalyzer(string assertion) => VerifyCSharpDiagnostic("int? actual, int? expected", assertion); - [AssertionDataTestMethod] + [DataTestMethod] [AssertionCodeFix( oldAssertion: "Assert.AreNotEqual(expected, actual{0});", newAssertion: "actual.Should().NotBe(expected{0});")] @@ -461,12 +461,12 @@ public void AssertDoubleAreNotEqual_TestCodeFix(string oldAssertion, string newA public void AssertOptionalIntAreNotEqual_TestCodeFix(string oldAssertion, string newAssertion) => VerifyCSharpFix("int? actual, int? expected", oldAssertion, newAssertion); - [AssertionDataTestMethod] + [DataTestMethod] [AssertionDiagnostic("Assert.AreNotEqual(actual, null{0});")] [Implemented] public void AssertOptionalIntAndNullAreNotEqual_TestAnalyzer(string assertion) => VerifyCSharpDiagnostic("int? actual", assertion); - [AssertionDataTestMethod] + [DataTestMethod] [AssertionCodeFix( oldAssertion: "Assert.AreNotEqual(actual, null{0});", newAssertion: "actual.Should().NotBeNull({0});")] @@ -474,13 +474,13 @@ public void AssertOptionalIntAreNotEqual_TestCodeFix(string oldAssertion, string public void AssertOptionalIntAndNullAreNotEqual_TestCodeFix(string oldAssertion, string newAssertion) => VerifyCSharpFix("int? actual", oldAssertion, newAssertion); - [AssertionDataTestMethod] + [DataTestMethod] [AssertionDiagnostic("Assert.AreNotEqual(expected, actual, delta{0});")] [AssertionDiagnostic("Assert.AreNotEqual(expected, actual, 0.6f{0});")] [Implemented] public void AssertFloatAreNotEqual_TestAnalyzer(string assertion) => VerifyCSharpDiagnostic("float actual, float expected, float delta", assertion); - [AssertionDataTestMethod] + [DataTestMethod] [AssertionCodeFix( oldAssertion: "Assert.AreNotEqual(expected, actual, delta{0});", newAssertion: "actual.Should().NotBeApproximately(expected, delta{0});")] @@ -491,7 +491,7 @@ public void AssertOptionalIntAndNullAreNotEqual_TestCodeFix(string oldAssertion, public void AssertFloatAreNotEqual_TestCodeFix(string oldAssertion, string newAssertion) => VerifyCSharpFix("float actual, float expected, float delta", oldAssertion, newAssertion); - [AssertionDataTestMethod] + [DataTestMethod] [AssertionDiagnostic("Assert.AreNotEqual(expected, actual{0});")] [AssertionDiagnostic("Assert.AreNotEqual(expected, actual, false{0});")] [AssertionDiagnostic("Assert.AreNotEqual(expected, actual, true{0});")] @@ -500,7 +500,7 @@ public void AssertFloatAreNotEqual_TestCodeFix(string oldAssertion, string newAs [Implemented] public void AssertStringAreNotEqual_TestAnalyzer(string assertion) => VerifyCSharpDiagnostic("string actual, string expected", assertion); - [AssertionDataTestMethod] + [DataTestMethod] [AssertionCodeFix( oldAssertion: "Assert.AreNotEqual(expected, actual{0});", newAssertion: "actual.Should().NotBe(expected{0});")] @@ -520,12 +520,12 @@ public void AssertFloatAreNotEqual_TestCodeFix(string oldAssertion, string newAs public void AssertStringAreNotEqual_TestCodeFix(string oldAssertion, string newAssertion) => VerifyCSharpFix("string actual, string expected", oldAssertion, newAssertion); - [AssertionDataTestMethod] + [DataTestMethod] [AssertionDiagnostic("Assert.AreSame(expected, actual{0});")] [Implemented] public void AssertAreSame_TestAnalyzer(string assertion) => VerifyCSharpDiagnostic("object actual, object expected", assertion); - [AssertionDataTestMethod] + [DataTestMethod] [AssertionCodeFix( oldAssertion: "Assert.AreSame(expected, actual{0});", newAssertion: "actual.Should().BeSameAs(expected{0});")] @@ -533,12 +533,12 @@ public void AssertStringAreNotEqual_TestCodeFix(string oldAssertion, string newA public void AssertAreSame_TestCodeFix(string oldAssertion, string newAssertion) => VerifyCSharpFix("object actual, object expected", oldAssertion, newAssertion); - [AssertionDataTestMethod] + [DataTestMethod] [AssertionDiagnostic("Assert.AreNotSame(expected, actual{0});")] [Implemented] public void AssertAreNotSame_TestAnalyzer(string assertion) => VerifyCSharpDiagnostic("object actual, object expected", assertion); - [AssertionDataTestMethod] + [DataTestMethod] [AssertionCodeFix( oldAssertion: "Assert.AreNotSame(expected, actual{0});", newAssertion: "actual.Should().NotBeSameAs(expected{0});")] @@ -546,12 +546,12 @@ public void AssertAreSame_TestCodeFix(string oldAssertion, string newAssertion) public void AssertAreNotSame_TestCodeFix(string oldAssertion, string newAssertion) => VerifyCSharpFix("object actual, object expected", oldAssertion, newAssertion); - [AssertionDataTestMethod] + [DataTestMethod] [AssertionDiagnostic("Assert.ThrowsException(action{0});")] [Implemented] public void AssertThrowsException_TestAnalyzer(string assertion) => VerifyCSharpDiagnostic("Action action", assertion); - [AssertionDataTestMethod] + [DataTestMethod] [AssertionCodeFix( oldAssertion: "Assert.ThrowsException(action{0});", newAssertion: "action.Should().ThrowExactly({0});")] @@ -559,12 +559,12 @@ public void AssertAreNotSame_TestCodeFix(string oldAssertion, string newAssertio public void AssertThrowsException_TestCodeFix(string oldAssertion, string newAssertion) => VerifyCSharpFix("Action action", oldAssertion, newAssertion); - [AssertionDataTestMethod] + [DataTestMethod] [AssertionDiagnostic("Assert.ThrowsExceptionAsync(action{0});")] [Implemented] public void AssertThrowsExceptionAsync_TestAnalyzer(string assertion) => VerifyCSharpDiagnostic("Func action", assertion); - [AssertionDataTestMethod] + [DataTestMethod] [AssertionCodeFix( oldAssertion: "Assert.ThrowsExceptionAsync(action{0});", newAssertion: "action.Should().ThrowExactlyAsync({0});")] @@ -572,7 +572,7 @@ public void AssertThrowsException_TestCodeFix(string oldAssertion, string newAss public void AssertThrowsExceptionAsync_TestCodeFix(string oldAssertion, string newAssertion) => VerifyCSharpFix("Func action", oldAssertion, newAssertion); - [AssertionDataTestMethod] + [DataTestMethod] [AssertionDiagnostic("CollectionAssert.AllItemsAreInstancesOfType(actual, type{0});")] [AssertionDiagnostic("CollectionAssert.AllItemsAreInstancesOfType(actual, typeof(int){0});")] [AssertionDiagnostic("CollectionAssert.AllItemsAreInstancesOfType(actual, typeof(Int32){0});")] @@ -580,7 +580,7 @@ public void AssertThrowsExceptionAsync_TestCodeFix(string oldAssertion, string n [Implemented] public void CollectionAssertAllItemsAreInstancesOfType_TestAnalyzer(string assertion) => VerifyCSharpDiagnostic("System.Collections.Generic.List actual, Type type", assertion); - [AssertionDataTestMethod] + [DataTestMethod] [AssertionCodeFix( oldAssertion: "CollectionAssert.AllItemsAreInstancesOfType(actual, type{0});", newAssertion: "actual.Should().AllBeOfType(type{0});")] @@ -596,180 +596,180 @@ public void AssertThrowsExceptionAsync_TestCodeFix(string oldAssertion, string n [Implemented] public void CollectionAssertAllItemsAreInstancesOfType_TestCodeFix(string oldAssertion, string newAssertion) => VerifyCSharpFix("System.Collections.Generic.List actual, Type type", oldAssertion, newAssertion); - [AssertionDataTestMethod] + [DataTestMethod] [AssertionDiagnostic("CollectionAssert.AreEqual(expected, actual{0});")] [Implemented] public void CollectionAssertAreEqual_TestAnalyzer(string assertion) => VerifyCSharpDiagnostic("System.Collections.Generic.List actual, System.Collections.Generic.List expected", assertion); - [AssertionDataTestMethod] + [DataTestMethod] [AssertionCodeFix( oldAssertion: "CollectionAssert.AreEqual(expected, actual{0});", newAssertion: "actual.Should().Equal(expected{0});")] [Implemented] public void CollectionAssertAreEqual_TestCodeFix(string oldAssertion, string newAssertion) => VerifyCSharpFix("System.Collections.Generic.List actual, System.Collections.Generic.List expected", oldAssertion, newAssertion); - [AssertionDataTestMethod] + [DataTestMethod] [AssertionDiagnostic("CollectionAssert.AreNotEqual(expected, actual{0});")] [Implemented] public void CollectionAssertAreNotEqual_TestAnalyzer(string assertion) => VerifyCSharpDiagnostic("System.Collections.Generic.List actual, System.Collections.Generic.List expected", assertion); - [AssertionDataTestMethod] + [DataTestMethod] [AssertionCodeFix( oldAssertion: "CollectionAssert.AreNotEqual(expected, actual{0});", newAssertion: "actual.Should().NotEqual(expected{0});")] [Implemented] public void CollectionAssertAreNotEqual_TestCodeFix(string oldAssertion, string newAssertion) => VerifyCSharpFix("System.Collections.Generic.List actual, System.Collections.Generic.List expected", oldAssertion, newAssertion); - [AssertionDataTestMethod] + [DataTestMethod] [AssertionDiagnostic("CollectionAssert.AreEquivalent(expected, actual{0});")] [Implemented] public void CollectionAssertAreEquivalent_TestAnalyzer(string assertion) => VerifyCSharpDiagnostic("System.Collections.Generic.List actual, System.Collections.Generic.List expected", assertion); - [AssertionDataTestMethod] + [DataTestMethod] [AssertionCodeFix( oldAssertion: "CollectionAssert.AreEquivalent(expected, actual{0});", newAssertion: "actual.Should().BeEquivalentTo(expected{0});")] [Implemented] public void CollectionAssertAreEquivalent_TestCodeFix(string oldAssertion, string newAssertion) => VerifyCSharpFix("System.Collections.Generic.List actual, System.Collections.Generic.List expected", oldAssertion, newAssertion); - [AssertionDataTestMethod] + [DataTestMethod] [AssertionDiagnostic("CollectionAssert.AreNotEquivalent(expected, actual{0});")] [Implemented] public void CollectionAssertAreNotEquivalent_TestAnalyzer(string assertion) => VerifyCSharpDiagnostic("System.Collections.Generic.List actual, System.Collections.Generic.List expected", assertion); - [AssertionDataTestMethod] + [DataTestMethod] [AssertionCodeFix( oldAssertion: "CollectionAssert.AreNotEquivalent(expected, actual{0});", newAssertion: "actual.Should().NotBeEquivalentTo(expected{0});")] [Implemented] public void CollectionAssertAreNotEquivalent_TestCodeFix(string oldAssertion, string newAssertion) => VerifyCSharpFix("System.Collections.Generic.List actual, System.Collections.Generic.List expected", oldAssertion, newAssertion); - [AssertionDataTestMethod] + [DataTestMethod] [AssertionDiagnostic("CollectionAssert.AllItemsAreNotNull(actual{0});")] [Implemented] public void CollectionAssertAllItemsAreNotNull_TestAnalyzer(string assertion) => VerifyCSharpDiagnostic("System.Collections.Generic.List actual", assertion); - [AssertionDataTestMethod] + [DataTestMethod] [AssertionCodeFix( oldAssertion: "CollectionAssert.AllItemsAreNotNull(actual{0});", newAssertion: "actual.Should().NotContainNulls({0});")] [Implemented] public void CollectionAssertAllItemsAreNotNull_TestCodeFix(string oldAssertion, string newAssertion) => VerifyCSharpFix("System.Collections.Generic.List actual", oldAssertion, newAssertion); - [AssertionDataTestMethod] + [DataTestMethod] [AssertionDiagnostic("CollectionAssert.AllItemsAreUnique(actual{0});")] [Implemented] public void CollectionAssertAllItemsAreUnique_TestAnalyzer(string assertion) => VerifyCSharpDiagnostic("System.Collections.Generic.List actual", assertion); - [AssertionDataTestMethod] + [DataTestMethod] [AssertionCodeFix( oldAssertion: "CollectionAssert.AllItemsAreUnique(actual{0});", newAssertion: "actual.Should().OnlyHaveUniqueItems({0});")] [Implemented] public void CollectionAssertAllItemsAreUnique_TestCodeFix(string oldAssertion, string newAssertion) => VerifyCSharpFix("System.Collections.Generic.List actual", oldAssertion, newAssertion); - [AssertionDataTestMethod] + [DataTestMethod] [AssertionDiagnostic("CollectionAssert.Contains(actual, expected{0});")] [Implemented] public void CollectionAssertContains_TestAnalyzer(string assertion) => VerifyCSharpDiagnostic("System.Collections.Generic.List actual, int expected", assertion); - [AssertionDataTestMethod] + [DataTestMethod] [AssertionCodeFix( oldAssertion: "CollectionAssert.Contains(actual, expected{0});", newAssertion: "actual.Should().Contain(expected{0});")] [Implemented] public void CollectionAssertContains_TestCodeFix(string oldAssertion, string newAssertion) => VerifyCSharpFix("System.Collections.Generic.List actual, int expected", oldAssertion, newAssertion); - [AssertionDataTestMethod] + [DataTestMethod] [AssertionDiagnostic("CollectionAssert.DoesNotContain(actual, expected{0});")] [Implemented] public void CollectionAssertDoesNotContain_TestAnalyzer(string assertion) => VerifyCSharpDiagnostic("System.Collections.Generic.List actual, int expected", assertion); - [AssertionDataTestMethod] + [DataTestMethod] [AssertionCodeFix( oldAssertion: "CollectionAssert.DoesNotContain(actual, expected{0});", newAssertion: "actual.Should().NotContain(expected{0});")] [Implemented] public void CollectionAssertDoesNotContain_TestCodeFix(string oldAssertion, string newAssertion) => VerifyCSharpFix("System.Collections.Generic.List actual, int expected", oldAssertion, newAssertion); - [AssertionDataTestMethod] + [DataTestMethod] [AssertionDiagnostic("CollectionAssert.IsSubsetOf(expected, actual{0});")] [Implemented] public void CollectionAssertIsSubsetOf_TestAnalyzer(string assertion) => VerifyCSharpDiagnostic("System.Collections.Generic.List actual, System.Collections.Generic.List expected", assertion); - [AssertionDataTestMethod] + [DataTestMethod] [AssertionCodeFix( oldAssertion: "CollectionAssert.IsSubsetOf(expected, actual{0});", newAssertion: "actual.Should().BeSubsetOf(expected{0});")] [Implemented] public void CollectionAssertIsSubsetOf_TestCodeFix(string oldAssertion, string newAssertion) => VerifyCSharpFix("System.Collections.Generic.List actual, System.Collections.Generic.List expected", oldAssertion, newAssertion); - [AssertionDataTestMethod] + [DataTestMethod] [AssertionDiagnostic("CollectionAssert.IsNotSubsetOf(expected, actual{0});")] [Implemented] public void CollectionAssertIsNotSubsetOf_TestAnalyzer(string assertion) => VerifyCSharpDiagnostic("System.Collections.Generic.List actual, System.Collections.Generic.List expected", assertion); - [AssertionDataTestMethod] + [DataTestMethod] [AssertionCodeFix( oldAssertion: "CollectionAssert.IsNotSubsetOf(expected, actual{0});", newAssertion: "actual.Should().NotBeSubsetOf(expected{0});")] [Implemented] public void CollectionAssertIsNotSubsetOf_TestCodeFix(string oldAssertion, string newAssertion) => VerifyCSharpFix("System.Collections.Generic.List actual, System.Collections.Generic.List expected", oldAssertion, newAssertion); - [AssertionDataTestMethod] + [DataTestMethod] [AssertionDiagnostic("StringAssert.Contains(expected, actual{0});")] [Implemented] public void StringAssertContains_TestAnalyzer(string assertion) => VerifyCSharpDiagnostic("string actual, string expected", assertion); - [AssertionDataTestMethod] + [DataTestMethod] [AssertionCodeFix( oldAssertion: "StringAssert.Contains(expected, actual{0});", newAssertion: "actual.Should().Contain(expected{0});")] [Implemented] public void StringAssertContains_TestCodeFix(string oldAssertion, string newAssertion) => VerifyCSharpFix("string actual, string expected", oldAssertion, newAssertion); - [AssertionDataTestMethod] + [DataTestMethod] [AssertionDiagnostic("StringAssert.StartsWith(expected, actual{0});")] [Implemented] public void StringAssertStartsWith_TestAnalyzer(string assertion) => VerifyCSharpDiagnostic("string actual, string expected", assertion); - [AssertionDataTestMethod] + [DataTestMethod] [AssertionCodeFix( oldAssertion: "StringAssert.StartsWith(expected, actual{0});", newAssertion: "actual.Should().StartWith(expected{0});")] [Implemented] public void StringAssertStartsWith_TestCodeFix(string oldAssertion, string newAssertion) => VerifyCSharpFix("string actual, string expected", oldAssertion, newAssertion); - [AssertionDataTestMethod] + [DataTestMethod] [AssertionDiagnostic("StringAssert.EndsWith(expected, actual{0});")] [Implemented] public void StringAssertEndsWith_TestAnalyzer(string assertion) => VerifyCSharpDiagnostic("string actual, string expected", assertion); - [AssertionDataTestMethod] + [DataTestMethod] [AssertionCodeFix( oldAssertion: "StringAssert.EndsWith(expected, actual{0});", newAssertion: "actual.Should().EndWith(expected{0});")] [Implemented] public void StringAssertEndsWith_TestCodeFix(string oldAssertion, string newAssertion) => VerifyCSharpFix("string actual, string expected", oldAssertion, newAssertion); - [AssertionDataTestMethod] + [DataTestMethod] [AssertionDiagnostic("StringAssert.Matches(actual, pattern{0});")] [Implemented] public void StringAssertMatches_TestAnalyzer(string assertion) => VerifyCSharpDiagnostic("string actual, System.Text.RegularExpressions.Regex pattern", assertion); - [AssertionDataTestMethod] + [DataTestMethod] [AssertionCodeFix( oldAssertion: "StringAssert.Matches(actual, pattern{0});", newAssertion: "actual.Should().MatchRegex(pattern{0});")] [Implemented] public void StringAssertMatches_TestCodeFix(string oldAssertion, string newAssertion) => VerifyCSharpFix("string actual, System.Text.RegularExpressions.Regex pattern", oldAssertion, newAssertion); - [AssertionDataTestMethod] + [DataTestMethod] [AssertionDiagnostic("StringAssert.DoesNotMatch(actual, pattern{0});")] [Implemented] public void StringAssertDoesNotMatch_TestAnalyzer(string assertion) => VerifyCSharpDiagnostic("string actual, System.Text.RegularExpressions.Regex pattern", assertion); - [AssertionDataTestMethod] + [DataTestMethod] [AssertionCodeFix( oldAssertion: "StringAssert.DoesNotMatch(actual, pattern{0});", newAssertion: "actual.Should().NotMatchRegex(pattern{0});")] diff --git a/src/FluentAssertions.Analyzers.Tests/Tips/NullConditionalAssertionTests.cs b/src/FluentAssertions.Analyzers.Tests/Tips/NullConditionalAssertionTests.cs index a37ae8d5..9181a1ff 100644 --- a/src/FluentAssertions.Analyzers.Tests/Tips/NullConditionalAssertionTests.cs +++ b/src/FluentAssertions.Analyzers.Tests/Tips/NullConditionalAssertionTests.cs @@ -6,7 +6,7 @@ namespace FluentAssertions.Analyzers.Tests.Tips [TestClass] public class NullConditionalAssertionTests { - [AssertionDataTestMethod] + [DataTestMethod] [AssertionDiagnostic("actual?.Should().Be(expected{0});")] [AssertionDiagnostic("actual?.MyProperty.Should().Be(\"test\"{0});")] [AssertionDiagnostic("actual.MyProperty?.Should().Be(\"test\"{0});")] @@ -17,7 +17,7 @@ public class NullConditionalAssertionTests [Implemented] public void NullConditionalMayNotExecuteTest(string assertion) => VerifyCSharpDiagnostic(assertion); - [AssertionDataTestMethod] + [DataTestMethod] [AssertionDiagnostic("(actual?.MyProperty).Should().Be(\"test\"{0});")] [AssertionDiagnostic("actual.MyProperty.Should().Be(actual?.MyProperty{0});")] [AssertionDiagnostic("actual.MyList.Where(obj => obj?.ToString() == null).Count().Should().Be(0{0});")] diff --git a/src/FluentAssertions.Analyzers.Tests/Tips/NumericTests.cs b/src/FluentAssertions.Analyzers.Tests/Tips/NumericTests.cs index b1d25f86..62abd7c0 100644 --- a/src/FluentAssertions.Analyzers.Tests/Tips/NumericTests.cs +++ b/src/FluentAssertions.Analyzers.Tests/Tips/NumericTests.cs @@ -7,13 +7,13 @@ namespace FluentAssertions.Analyzers.Tests [TestClass] public class NumericTests { - [AssertionDataTestMethod] + [DataTestMethod] [AssertionDiagnostic("actual.Should().BeGreaterThan(0{0});")] [AssertionDiagnostic("actual.Should().BeGreaterThan(0{0}).ToString();")] [Implemented] public void NumericShouldBePositive_TestAnalyzer(string assertion) => VerifyCSharpDiagnostic(assertion); - [AssertionDataTestMethod] + [DataTestMethod] [AssertionCodeFix( oldAssertion: "actual.Should().BeGreaterThan(0{0});", newAssertion: "actual.Should().BePositive({0});")] @@ -23,13 +23,13 @@ public class NumericTests [Implemented] public void NumericShouldBePositive_TestCodeFix(string oldAssertion, string newAssertion) => VerifyCSharpFix(oldAssertion, newAssertion); - [AssertionDataTestMethod] + [DataTestMethod] [AssertionDiagnostic("actual.Should().BeLessThan(0{0});")] [AssertionDiagnostic("actual.Should().BeLessThan(0{0}).ToString();")] [Implemented] public void NumericShouldBeNegative_TestAnalyzer(string assertion) => VerifyCSharpDiagnostic(assertion); - [AssertionDataTestMethod] + [DataTestMethod] [AssertionCodeFix( oldAssertion: "actual.Should().BeLessThan(0{0});", newAssertion: "actual.Should().BeNegative({0});")] @@ -39,7 +39,7 @@ public class NumericTests [Implemented] public void NumericShouldBeNegative_TestCodeFix(string oldAssertion, string newAssertion) => VerifyCSharpFix(oldAssertion, newAssertion); - [AssertionDataTestMethod] + [DataTestMethod] [AssertionDiagnostic("actual.Should().BeGreaterOrEqualTo(lower{0}).And.BeLessOrEqualTo(upper);")] [AssertionDiagnostic("actual.Should().BeGreaterOrEqualTo(lower).And.BeLessOrEqualTo(upper{0});")] [AssertionDiagnostic("actual.Should().BeGreaterOrEqualTo(lower{0}).And.BeLessOrEqualTo(upper{0});")] @@ -49,7 +49,7 @@ public class NumericTests [Implemented] public void NumericShouldBeInRange_TestAnalyzer(string assertion) => VerifyCSharpDiagnostic(assertion); - [AssertionDataTestMethod] + [DataTestMethod] [AssertionCodeFix( oldAssertion: "actual.Should().BeGreaterOrEqualTo(lower{0}).And.BeLessOrEqualTo(upper);", newAssertion: "actual.Should().BeInRange(lower, upper{0});")] @@ -65,12 +65,12 @@ public class NumericTests [NotImplemented] public void NumericShouldBeInRange_TestCodeFix(string oldAssertion, string newAssertion) => VerifyCSharpFix(oldAssertion, newAssertion); - [AssertionDataTestMethod] + [DataTestMethod] [AssertionDiagnostic("Math.Abs(expected - actual).Should().BeLessOrEqualTo(delta{0});")] [Implemented] public void NumericShouldBeApproximately_TestAnalyzer(string assertion) => VerifyCSharpDiagnostic(assertion); - [AssertionDataTestMethod] + [DataTestMethod] [AssertionCodeFix( oldAssertion: "Math.Abs(expected - actual).Should().BeLessOrEqualTo(delta{0});", newAssertion: "actual.Should().BeApproximately(expected, delta{0});")] diff --git a/src/FluentAssertions.Analyzers.Tests/Tips/StringTests.cs b/src/FluentAssertions.Analyzers.Tests/Tips/StringTests.cs index add36b47..7ec0ee53 100644 --- a/src/FluentAssertions.Analyzers.Tests/Tips/StringTests.cs +++ b/src/FluentAssertions.Analyzers.Tests/Tips/StringTests.cs @@ -7,13 +7,13 @@ namespace FluentAssertions.Analyzers.Tests [TestClass] public class StringTests { - [AssertionDataTestMethod] + [DataTestMethod] [AssertionDiagnostic("actual.StartsWith(expected).Should().BeTrue({0});")] [AssertionDiagnostic("actual.ToString().StartsWith(expected).Should().BeTrue({0}).And.ToString();")] [Implemented] public void StringShouldStartWith_TestAnalyzer(string assertion) => VerifyCSharpDiagnostic(assertion); - [AssertionDataTestMethod] + [DataTestMethod] [AssertionCodeFix( oldAssertion: "actual.StartsWith(expected).Should().BeTrue({0});", newAssertion: "actual.Should().StartWith(expected{0});")] @@ -23,13 +23,13 @@ public class StringTests [Implemented] public void StringShouldStartWith_TestCodeFix(string oldAssertion, string newAssertion) => VerifyCSharpFix(oldAssertion, newAssertion); - [AssertionDataTestMethod] + [DataTestMethod] [AssertionDiagnostic("actual.EndsWith(expected).Should().BeTrue({0});")] [AssertionDiagnostic("actual.ToString().EndsWith(expected).Should().BeTrue({0}).And.ToString();")] [Implemented] public void StringShouldEndWith_TestAnalyzer(string assertion) => VerifyCSharpDiagnostic(assertion); - [AssertionDataTestMethod] + [DataTestMethod] [AssertionCodeFix( oldAssertion: "actual.EndsWith(expected).Should().BeTrue({0});", newAssertion: "actual.Should().EndWith(expected{0});")] @@ -39,7 +39,7 @@ public class StringTests [Implemented] public void StringShouldEndWith_TestCodeFix(string oldAssertion, string newAssertion) => VerifyCSharpFix(oldAssertion, newAssertion); - [AssertionDataTestMethod] + [DataTestMethod] [AssertionDiagnostic("actual.Should().NotBeNull().And.NotBeEmpty({0});")] [AssertionDiagnostic("actual.Should().NotBeNull({0}).And.NotBeEmpty();")] [AssertionDiagnostic("string.IsNullOrEmpty(actual).Should().BeFalse({0});")] @@ -50,7 +50,7 @@ public class StringTests [Implemented] public void StringShouldNotBeNullOrEmpty_TestAnalyzer(string assertion) => VerifyCSharpDiagnostic(assertion); - [AssertionDataTestMethod] + [DataTestMethod] [AssertionCodeFix( oldAssertion: "actual.Should().NotBeNull({0}).And.NotBeEmpty();", newAssertion: "actual.Should().NotBeNullOrEmpty({0});")] @@ -84,13 +84,13 @@ public class StringTests [Implemented] public void StringShouldNotBeNullOrEmpty_TestCodeFix(string oldAssertion, string newAssertion) => VerifyCSharpFix(oldAssertion, newAssertion); - [AssertionDataTestMethod] + [DataTestMethod] [AssertionDiagnostic("string.IsNullOrEmpty(actual).Should().BeTrue({0});")] [AssertionDiagnostic("string.IsNullOrEmpty(actual.ToString()).Should().BeTrue({0}).And.ToString();")] [Implemented] public void StringShouldBeNullOrEmpty_TestAnalyzer(string assertion) => VerifyCSharpDiagnostic(assertion); - [AssertionDataTestMethod] + [DataTestMethod] [AssertionCodeFix( oldAssertion: "string.IsNullOrEmpty(actual).Should().BeTrue({0});", newAssertion: "actual.Should().BeNullOrEmpty({0});")] @@ -100,7 +100,7 @@ public class StringTests [Implemented] public void StringShouldBeNullOrEmpty_TestCodeFix(string oldAssertion, string newAssertion) => VerifyCSharpFix(oldAssertion, newAssertion); - [AssertionDataTestMethod] + [DataTestMethod] [AssertionDiagnostic("string.IsNullOrWhiteSpace(actual).Should().BeTrue({0});")] [AssertionDiagnostic("string.IsNullOrWhiteSpace(actual).Should().BeTrue({0}).And.ToString();")] [AssertionDiagnostic("string.IsNullOrWhiteSpace(actual.ToString()).Should().BeTrue({0});")] @@ -108,7 +108,7 @@ public class StringTests [Implemented] public void StringShouldBeNullOrWhiteSpace_TestAnalyzer(string assertion) => VerifyCSharpDiagnostic(assertion); - [AssertionDataTestMethod] + [DataTestMethod] [AssertionCodeFix( oldAssertion: "string.IsNullOrWhiteSpace(actual).Should().BeTrue({0});", newAssertion: "actual.Should().BeNullOrWhiteSpace({0});")] @@ -124,7 +124,7 @@ public class StringTests [Implemented] public void StringShouldBeNullOrWhiteSpace_TestCodeFix(string oldAssertion, string newAssertion) => VerifyCSharpFix(oldAssertion, newAssertion); - [AssertionDataTestMethod] + [DataTestMethod] [AssertionDiagnostic("string.IsNullOrWhiteSpace(actual).Should().BeFalse({0});")] [AssertionDiagnostic("string.IsNullOrWhiteSpace(actual).Should().BeFalse({0}).And.ToString();")] [AssertionDiagnostic("string.IsNullOrWhiteSpace(actual.ToString()).Should().BeFalse({0});")] @@ -132,7 +132,7 @@ public class StringTests [Implemented] public void StringShouldNotBeNullOrWhiteSpace_TestAnalyzer(string assertion) => VerifyCSharpDiagnostic(assertion); - [AssertionDataTestMethod] + [DataTestMethod] [AssertionCodeFix( oldAssertion: "string.IsNullOrWhiteSpace(actual).Should().BeFalse({0});", newAssertion: "actual.Should().NotBeNullOrWhiteSpace({0});")] @@ -148,13 +148,13 @@ public class StringTests [Implemented] public void StringShouldNotBeNullOrWhiteSpace_TestCodeFix(string oldAssertion, string newAssertion) => VerifyCSharpFix(oldAssertion, newAssertion); - [AssertionDataTestMethod] + [DataTestMethod] [AssertionDiagnostic("actual.Length.Should().Be(k{0});")] [AssertionDiagnostic("actual.ToString().Length.Should().Be(k{0}).And.ToString();")] [Implemented] public void StringShouldHaveLength_TestAnalyzer(string assertion) => VerifyCSharpDiagnostic(assertion); - [AssertionDataTestMethod] + [DataTestMethod] [AssertionCodeFix( oldAssertion: "actual.Length.Should().Be(k{0});", newAssertion: "actual.Should().HaveLength(k{0});")]