Skip to content

Commit b475b0f

Browse files
authored
tests: update FluentAssertions to version 6.1.0 (#112)
* update FluentAssertions to version 6.1.0 * update referenced assemblies for test code * remove tests for non generic collections * update test asserting the AndConstraint
1 parent c07c19a commit b475b0f

File tree

5 files changed

+4
-54
lines changed

5 files changed

+4
-54
lines changed

src/FluentAssertions.Analyzers.Tests/DiagnosticVerifier.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ static DiagnosticVerifier()
3535
typeof(AssertionScope), // FluentAssertions.Core
3636
typeof(AssertionExtensions), // FluentAssertions
3737
}.Select(type => type.GetTypeInfo().Assembly.Location)
38+
.Append(GetSystemAssemblyPathByName("System.Runtime.Extensions.dll"))
39+
.Append(GetSystemAssemblyPathByName("System.Data.Common.dll"))
3840
.Append(GetSystemAssemblyPathByName("System.Threading.Tasks.dll"))
3941
.Append(GetSystemAssemblyPathByName("System.Runtime.dll"))
4042
.Append(GetSystemAssemblyPathByName("System.Reflection.dll"))

src/FluentAssertions.Analyzers.Tests/FluentAssertions.Analyzers.Tests.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
</PropertyGroup>
88

99
<ItemGroup>
10-
<PackageReference Include="FluentAssertions" Version="5.9.0" />
10+
<PackageReference Include="FluentAssertions" Version="6.1.0" />
1111
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.3.0" />
1212
<PackageReference Include="MSTest.TestAdapter" Version="2.0.0" />
1313
<PackageReference Include="MSTest.TestFramework" Version="2.0.0" />

src/FluentAssertions.Analyzers.Tests/GenerateCode.cs

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -33,24 +33,6 @@ public static string GenericIListExpressionBodyAssertion(string assertion) => Ge
3333
.AppendLine("}")
3434
.ToString();
3535

36-
public static string IEnumerableAssertion(string assertion) => new StringBuilder()
37-
.AppendLine("using System.Collections;")
38-
.AppendLine("using System.Linq;")
39-
.AppendLine("using System;")
40-
.AppendLine("using FluentAssertions;using FluentAssertions.Extensions;")
41-
.AppendLine("namespace TestNamespace")
42-
.AppendLine("{")
43-
.AppendLine(" public class TestClass")
44-
.AppendLine(" {")
45-
.AppendLine(" public void TestMethod(IEnumerable actual, IEnumerable expected)")
46-
.AppendLine(" {")
47-
.AppendLine($" {assertion}")
48-
.AppendLine(" }")
49-
.AppendLine(" }")
50-
.AppendMainMethod()
51-
.AppendLine("}")
52-
.ToString();
53-
5436
public static string GenericIEnumerableAssertion(string assertion) => new StringBuilder()
5537
.AppendLine("using System.Collections.Generic;")
5638
.AppendLine("using System.Linq;")

src/FluentAssertions.Analyzers.Tests/Tips/CollectionTests.cs

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -356,15 +356,6 @@ public class CollectionTests
356356
[Implemented]
357357
public void CollectionShouldNotHaveSameCount_TestCodeFix(string oldAssertion, string newAssertion) => VerifyCSharpFixCodeBlock<CollectionShouldNotHaveSameCountCodeFix, CollectionShouldNotHaveSameCountAnalyzer>(oldAssertion, newAssertion);
358358

359-
[AssertionDataTestMethod]
360-
[AssertionDiagnostic("actual.Should().HaveCount(1{0});")]
361-
[Implemented]
362-
public void CollectionShouldContainSingle_TestAnalyzer_NonGenericIEnumerableShouldNotReport(string assertion)
363-
{
364-
var source = GenerateCode.IEnumerableAssertion(assertion);
365-
DiagnosticVerifier.VerifyCSharpDiagnosticUsingAllAnalyzers(source);
366-
}
367-
368359
[AssertionDataTestMethod]
369360
[AssertionDiagnostic("actual.Should().HaveCount(1{0});")]
370361
[Implemented]

src/FluentAssertions.Analyzers.Tests/Tips/SanityTests.cs

Lines changed: 1 addition & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ public static void Main()
155155
[Implemented(Reason = "https://github.com/fluentassertions/fluentassertions.analyzers/issues/63")]
156156
public void StringShouldNotBeEmptyAndShouldNotBeNull_ShouldNotTrigger()
157157
{
158-
const string assertion = "actual.Should().NotBeEmpty().And.Should().NotBeNull();";
158+
const string assertion = "actual.Should().NotBeEmpty().And.Subject.Should().NotBeNull();";
159159
var source = GenerateCode.StringAssertion(assertion);
160160

161161
DiagnosticVerifier.VerifyCSharpDiagnosticUsingAllAnalyzers(source);
@@ -258,30 +258,5 @@ public static void Main()
258258

259259
DiagnosticVerifier.VerifyCSharpDiagnosticUsingAllAnalyzers(source);
260260
}
261-
262-
[TestMethod]
263-
[Implemented(Reason = "https://github.com/fluentassertions/fluentassertions.analyzers/issues/82")]
264-
public void XmlNodeListShouldHaveCount1_ShouldNotReport()
265-
{
266-
const string source = @"
267-
using System.Xml;
268-
using System.Collections.Generic;
269-
using FluentAssertions;
270-
using FluentAssertions.Extensions;
271-
272-
namespace TestNamespace
273-
{
274-
public class Program
275-
{
276-
public static void Main()
277-
{
278-
XmlNodeList childNodes = new XmlDocument().ChildNodes;
279-
childNodes.Should().HaveCount(1);
280-
}
281-
}
282-
}";
283-
284-
DiagnosticVerifier.VerifyCSharpDiagnosticUsingAllAnalyzers(source);
285-
}
286261
}
287262
}

0 commit comments

Comments
 (0)