Skip to content

Commit

Permalink
C#12 collection initialization expression (#142)
Browse files Browse the repository at this point in the history
  • Loading branch information
sungam3r authored Nov 18, 2023
1 parent 118417a commit a734ca6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
10 changes: 5 additions & 5 deletions src/Example/Models/Repository.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,18 @@ public Repository()

public List<Person> GetPersons()
{
return new List<Person>
{
new Person
return
[
new()
{
Name = "Chip",
Age = 31
},
new Person
new()
{
Name = "Dale",
Age = 32
}
};
];
}
}
5 changes: 2 additions & 3 deletions src/SteroidsDI.Tests/Cases.Approval/ApiApprovalTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
namespace SteroidsDI.Tests.Cases;

/// <summary> Tests for checking changes to the public API. </summary>
/// <see href="https://github.com/JakeGinnivan/ApiApprover"/>
[TestFixture]
public class ApiApprovalTests
{
Expand All @@ -21,8 +20,8 @@ public void PublicApi(Type type)
string publicApi = type.Assembly.GeneratePublicApi(new ApiGeneratorOptions
{
IncludeAssemblyAttributes = false,
AllowNamespacePrefixes = new[] { "System", "Microsoft.Extensions.DependencyInjection" },
ExcludeAttributes = new[] { "System.Diagnostics.DebuggerDisplayAttribute" },
AllowNamespacePrefixes = ["System", "Microsoft.Extensions.DependencyInjection"],
ExcludeAttributes = ["System.Diagnostics.DebuggerDisplayAttribute"],
});

publicApi.ShouldMatchApproved(options => options!.WithFilenameGenerator((testMethodInfo, discriminator, fileType, fileExtension) => $"{type.Assembly.GetName().Name!}.{fileType}.{fileExtension}"));
Expand Down

0 comments on commit a734ca6

Please sign in to comment.