Skip to content

Commit

Permalink
tests: sanity test for issue #290
Browse files Browse the repository at this point in the history
  • Loading branch information
Meir017 committed Jan 15, 2024
1 parent 2e2d70c commit a391d11
Showing 1 changed file with 46 additions and 0 deletions.
46 changes: 46 additions & 0 deletions src/FluentAssertions.Analyzers.Tests/Tips/SanityTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -448,5 +448,51 @@ public class MyCollectionType { }";
})
);
}

[TestMethod]
[Implemented(Reason = "https://github.com/fluentassertions/fluentassertions.analyzers/issues/290")]
public void ShouldNotReportIssue290()
{
const string source = @"
using FluentAssertions;
using FluentAssertions.Extensions;
using System;
using System.Collections.Generic;
using System.Linq;
public class TestClass
{
public static void Main()
{
IEnumerable<string> expectedOrderedNames = new[] { ""Alpha"", ""Bravo"", ""Charlie"" };
IEnumerable<Item> actual = GetSortedItems();
actual.Select(x => x.Name).Should().Equal(expectedOrderedNames);
}
static IEnumerable<Item> GetSortedItems() {
yield return new Item(""Bravo"", Guid.NewGuid());
yield return new Item(""Charlie"", Guid.NewGuid());
yield return new Item(""Alpha"", Guid.NewGuid());
}
}
public class Item
{
public string Name { get; set; }
public Guid Id { get; set; }
public Item(string name, Guid id)
{
Name = name;
Id = id;
}
}";

DiagnosticVerifier.VerifyDiagnostic(new DiagnosticVerifierArguments()
.WithSources(source)
.WithAllAnalyzers()
.WithPackageReferences(PackageReference.FluentAssertions_6_12_0)
);
}
}
}

0 comments on commit a391d11

Please sign in to comment.