Skip to content

Commit

Permalink
Handle xUnit2031 warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
mburumaxwell committed Sep 27, 2024
1 parent 55832d7 commit 81270ba
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
<PropertyGroup>
<WarningsAsErrors>$(WarningsAsErrors),IL2026,IL2060,IL2091,IL2095,IL3050</WarningsAsErrors>
<WarningsAsErrors>$(WarningsAsErrors),SYSLIB1045</WarningsAsErrors>
<WarningsAsErrors>$(WarningsAsErrors),xUnit2031</WarningsAsErrors>
</PropertyGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public void EnumDescriptionsFilters_AreAdded()

var options = services.GetRequiredService<IOptions<SwaggerGenOptions>>().Value;

Assert.Single(options.SchemaFilterDescriptors.Where(d => d.Type == typeof(EnumDescriptionsSchemaFilter)));
Assert.Single(options.SchemaFilterDescriptors, d => d.Type == typeof(EnumDescriptionsSchemaFilter));
}

[Fact]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public async Task InitializeCollectionIfNotExists()
Assert.Contains("session", await dbFixture.Database!.ListCollectionNames().ToListAsync());
var collection = dbFixture.Database.GetCollection<MongoCacheEntry>("session");
var indexes = await collection.Indexes.List().ToListAsync();
Assert.Single(indexes.Where(b => b["name"] != "_id_"));
Assert.Single(indexes, b => b["name"] != "_id_");
}

[Fact]
Expand Down Expand Up @@ -67,7 +67,7 @@ public async Task UsesExistingCollection()
// Verify that collection was not created
Assert.Equal("Cache", Assert.Single(await dbFixture.Database!.ListCollectionNames().ToListAsync()));
var indexes = await collection.Indexes.List().ToListAsync();
var ix = Assert.Single(indexes.Where(b => b["name"] != "_id_"));
var ix = Assert.Single(indexes, b => b["name"] != "_id_");
Assert.Equal(model.Options.Name, ix["name"]);
}

Expand Down

0 comments on commit 81270ba

Please sign in to comment.