Skip to content

Commit

Permalink
Fix XUnit warnings (AutoMapper#214)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexmo16 authored Jun 12, 2024
1 parent 1a9cd97 commit d091a40
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 56 deletions.
8 changes: 4 additions & 4 deletions AutoMapper.OData.EF6.Tests/GetQuerySelectTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public async void OpsTenantExpandBuildingsFilterEqAndOrderBy_FirstBuildingHasVal

void Test(ICollection<OpsTenant> collection)
{
Assert.Equal(1, collection.Count);
Assert.Single(collection);
Assert.Equal(2, collection.First().Buildings.Count);
Assert.NotNull(collection.First().Buildings.First().Name);
Assert.NotEqual(default, collection.First().Buildings.First().Identity);
Expand All @@ -90,7 +90,7 @@ public async void BuildingSelectNameExpandBuilder_BuilderNameShouldBeSam()

void Test(ICollection<CoreBuilding> collection)
{
Assert.Equal(1, collection.Count);
Assert.Single(collection);
Assert.Equal("Sam", collection.First().Builder.Name);
Assert.Equal(default, collection.First().Builder.Id);
Assert.Null(collection.First().Builder.City);
Expand All @@ -109,7 +109,7 @@ public async void BuildingExpandBuilderSelectNamefilterEqAndOrderBy()

void Test(ICollection<CoreBuilding> collection)
{
Assert.Equal(1, collection.Count);
Assert.Single(collection);
Assert.Equal("Sam", collection.First().Builder.Name);
Assert.Equal(default, collection.First().Builder.Id);
Assert.Null(collection.First().Builder.City);
Expand All @@ -128,7 +128,7 @@ public async void BuildingExpandBuilderSelectNameExpandCityFilterEqAndOrderBy_Ci

void Test(ICollection<CoreBuilding> collection)
{
Assert.Equal(1, collection.Count);
Assert.Single(collection);
Assert.Equal("Sam", collection.First().Builder.Name);
Assert.Equal(default, collection.First().Builder.Id);
Assert.Equal("London", collection.First().Builder.City.Name);
Expand Down
42 changes: 21 additions & 21 deletions AutoMapper.OData.EF6.Tests/GetQueryTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public async void OpsTenantSearch()

void Test(ICollection<OpsTenant> collection)
{
Assert.Equal(1, collection.Count);
Assert.Single(collection);
Assert.Equal("One", collection.First().Name);
}
}
Expand All @@ -78,7 +78,7 @@ public async void OpsTenantSearchAndFilter()

void Test(ICollection<OpsTenant> collection)
{
Assert.Equal(0, collection.Count);
Assert.Empty(collection);
}
}

Expand All @@ -92,7 +92,7 @@ public async void OpsTenantExpandBuildingsFilterEqAndOrderBy()

void Test(ICollection<OpsTenant> collection)
{
Assert.Equal(1, collection.Count);
Assert.Single(collection);
Assert.Equal(2, collection.First().Buildings.Count);
Assert.Equal("One", collection.First().Name);
}
Expand Down Expand Up @@ -141,7 +141,7 @@ public async void OpsTenantExpandBuildingsFilterNeAndOrderBy()

void Test(ICollection<OpsTenant> collection)
{
Assert.Equal(1, collection.Count);
Assert.Single(collection);
Assert.Equal(3, collection.First().Buildings.Count);
Assert.Equal("Two", collection.First().Name);
}
Expand All @@ -157,7 +157,7 @@ public async void OpsTenantFilterEqNoExpand()

void Test(ICollection<OpsTenant> collection)
{
Assert.Equal(1, collection.Count);
Assert.Single(collection);
Assert.Null(collection.First().Buildings);
Assert.Equal("One", collection.First().Name);
}
Expand Down Expand Up @@ -189,7 +189,7 @@ public async void OpsTenantFilterLtDateNoExpand()

void Test(ICollection<OpsTenant> collection)
{
Assert.Equal(0, collection.Count);
Assert.Empty(collection);
}
}

Expand Down Expand Up @@ -235,7 +235,7 @@ public async void OpsTenantNoExpandFilterEqAndOrderBy()

void Test(ICollection<OpsTenant> collection)
{
Assert.Equal(1, collection.Count);
Assert.Single(collection);
Assert.Null(collection.First().Buildings);
Assert.Equal("One", collection.First().Name);
}
Expand All @@ -251,7 +251,7 @@ public async void OpsTenantExpandBuildingsSelectNameAndBuilderExpandBuilderExpan

void Test(ICollection<OpsTenant> collection)
{
Assert.Equal(1, collection.Count);
Assert.Single(collection);
Assert.Equal(3, collection.First().Buildings.Count);
Assert.NotNull(collection.First().Buildings.First().Builder);
Assert.NotNull(collection.First().Buildings.First().Builder.City);
Expand All @@ -270,7 +270,7 @@ public async void OpsTenantExpandBuildingsExpandBuilderExpandCityFilterNeAndOrde

void Test(ICollection<OpsTenant> collection)
{
Assert.Equal(1, collection.Count);
Assert.Single(collection);
Assert.Equal(3, collection.First().Buildings.Count);
Assert.NotNull(collection.First().Buildings.First().Builder);
Assert.NotNull(collection.First().Buildings.First().Builder.City);
Expand Down Expand Up @@ -334,7 +334,7 @@ await GetUsingCustomNameSpace<CoreBuilding, TBuilding>

void Test(ICollection<CoreBuilding> collection)
{
Assert.Equal(1, collection.Count);
Assert.Single(collection);
Assert.Equal("One L1", collection.First().Name);
Assert.Equal(buildingParameterValue, collection.First().Parameter);
Assert.Equal("Sam", collection.First().Builder.Name);
Expand All @@ -352,7 +352,7 @@ public async void BuildingExpandBuilderTenantFilterEqAndOrderBy()

void Test(ICollection<CoreBuilding> collection)
{
Assert.Equal(1, collection.Count);
Assert.Single(collection);
Assert.Equal("Sam", collection.First().Builder.Name);
Assert.Equal("One", collection.First().Tenant.Name);
Assert.Equal("One L1", collection.First().Name);
Expand All @@ -369,7 +369,7 @@ public async void BuildingExpandBuilderSelectNameExpandTenantFilterEqAndOrderBy(

void Test(ICollection<CoreBuilding> collection)
{
Assert.Equal(1, collection.Count);
Assert.Single(collection);
Assert.Equal("Sam", collection.First().Builder.Name);
Assert.Equal("One", collection.First().Tenant.Name);
Assert.Equal("One L1", collection.First().Name);
Expand Down Expand Up @@ -504,7 +504,7 @@ public async void BuildingExpandBuilderTenantExpandCityOrderByBuilderNameSkip3Ta
void Test(ICollection<CoreBuilding> collection)
{
Assert.Equal(5, options.Request.ODataFeature().TotalCount);
Assert.Equal(1, collection.Count);
Assert.Single(collection);
Assert.Equal("London", collection.First().Builder.City.Name);
Assert.Equal("One L1", collection.First().Name);
}
Expand All @@ -527,7 +527,7 @@ public async void BuildingExpandBuilderTenantExpandCityOrderByBuilderNameSkip3Ta
void Test(ICollection<CoreBuilding> collection)
{
Assert.Null(options.Request.ODataFeature().TotalCount);
Assert.Equal(1, collection.Count);
Assert.Single(collection);
Assert.Equal("London", collection.First().Builder.City.Name);
Assert.Equal("One L1", collection.First().Name);
}
Expand Down Expand Up @@ -1090,7 +1090,7 @@ await GetUsingCustomNameSpace<CategoryModel, Category>
static void Test(ICollection<CategoryModel> collection)
{
Assert.Equal(2, collection.Count);
Assert.Equal(1, collection.First().Products.Count);
Assert.Single(collection.First().Products);
Assert.Equal(2, collection.First().Products.First().AlternateAddresses.Count());
}
}
Expand Down Expand Up @@ -1142,9 +1142,9 @@ public async void SkipOnRootNoOrderByThenExpandAndSkipOnChildCollectionNoOrderBy

static void Test(ICollection<CategoryModel> collection)
{
Assert.Equal(1, collection.Count);
Assert.Single(collection);
Assert.Equal(2, collection.First().CategoryID);
Assert.Equal(1, collection.First().Products.Count);
Assert.Single(collection.First().Products);
Assert.Equal(5, collection.First().Products.First().ProductID);
Assert.Equal(2, collection.First().Products.First().AlternateAddresses.Length);
Assert.Equal(4, collection.First().Products.First().AlternateAddresses.First().AddressID);
Expand All @@ -1162,9 +1162,9 @@ public async void SkipOnRootNoOrderByThenExpandAndSkipOnChildCollectionNoOrderBy

static void Test(ICollection<CategoryModel> collection)
{
Assert.Equal(1, collection.Count);
Assert.Single(collection);
Assert.Equal(2, collection.First().CategoryID);
Assert.Equal(1, collection.First().Products.Count);
Assert.Single(collection.First().Products);
Assert.Equal(5, collection.First().Products.First().ProductID);
Assert.Equal(2, collection.First().Products.First().AlternateAddresses.Length);
Assert.Equal(4, collection.First().Products.First().AlternateAddresses.First().AddressID);
Expand All @@ -1184,7 +1184,7 @@ static void Test(ICollection<CategoryModel> collection)
{
Assert.Equal(2, collection.First().Products.First().ProductID);
Assert.Equal(3, collection.First().Products.Last().ProductID);
Assert.Equal(1, collection.Last().Products.Count);
Assert.Single(collection.Last().Products);
Assert.Equal(5, collection.Last().Products.First().ProductID);
}
}
Expand Down Expand Up @@ -1262,7 +1262,7 @@ public async void SkipOnRootNoOrderBy()

static void Test(ICollection<CategoryModel> collection)
{
Assert.Equal(1, collection.Count);
Assert.Single(collection);
Assert.Equal(2, collection.First().CategoryID);
}
}
Expand Down
22 changes: 11 additions & 11 deletions AutoMapper.OData.EF6.Tests/GetTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public async void OpsTenantExpandBuildingsFilterEqAndOrderBy()

void Test(ICollection<OpsTenant> collection)
{
Assert.Equal(1, collection.Count);
Assert.Single(collection);
Assert.Equal(2, collection.First().Buildings.Count);
Assert.Equal("One", collection.First().Name);
}
Expand All @@ -79,7 +79,7 @@ public async void OpsTenantExpandBuildingsFilterNeAndOrderBy()

void Test(ICollection<OpsTenant> collection)
{
Assert.Equal(1, collection.Count);
Assert.Single(collection);
Assert.Equal(3, collection.First().Buildings.Count);
Assert.Equal("Two", collection.First().Name);
}
Expand All @@ -95,8 +95,8 @@ public async void OpsTenantFilterEqNoExpand()

void Test(ICollection<OpsTenant> collection)
{
Assert.Equal(1, collection.Count);
Assert.Equal(0, collection.First().Buildings.Count);
Assert.Single(collection);
Assert.Empty(collection.First().Buildings);
Assert.Equal("One", collection.First().Name);
}
}
Expand Down Expand Up @@ -128,7 +128,7 @@ public async void OpsTenantNoExpandNoFilterAndOrderBy()
void Test(ICollection<OpsTenant> collection)
{
Assert.Equal(2, collection.Count);
Assert.Equal(0, collection.First().Buildings.Count);
Assert.Empty(collection.First().Buildings);
Assert.Equal("Two", collection.First().Name);
}
}
Expand All @@ -143,8 +143,8 @@ public async void OpsTenantNoExpandFilterEqAndOrderBy()

void Test(ICollection<OpsTenant> collection)
{
Assert.Equal(1, collection.Count);
Assert.Equal(0, collection.First().Buildings.Count);
Assert.Single(collection);
Assert.Empty(collection.First().Buildings);
Assert.Equal("One", collection.First().Name);
}
}
Expand All @@ -159,7 +159,7 @@ public async void OpsTenantExpandBuildingsExpandBuilderExpandCityFilterNeAndOrde

void Test(ICollection<OpsTenant> collection)
{
Assert.Equal(1, collection.Count);
Assert.Single(collection);
Assert.Equal(3, collection.First().Buildings.Count);
Assert.NotNull(collection.First().Buildings.First().Builder);
Assert.NotNull(collection.First().Buildings.First().Builder.City);
Expand All @@ -177,7 +177,7 @@ public async void BuildingExpandBuilderTenantFilterEqAndOrderBy()

void Test(ICollection<CoreBuilding> collection)
{
Assert.Equal(1, collection.Count);
Assert.Single(collection);
Assert.Equal("Sam", collection.First().Builder.Name);
Assert.Equal("One", collection.First().Tenant.Name);
Assert.Equal("One L1", collection.First().Name);
Expand Down Expand Up @@ -312,7 +312,7 @@ public async void BuildingExpandBuilderTenantExpandCityOrderByBuilderNameSkip3Ta
void Test(ICollection<CoreBuilding> collection)
{
Assert.Equal(5, options.Request.ODataFeature().TotalCount);
Assert.Equal(1, collection.Count);
Assert.Single(collection);
Assert.Equal("London", collection.First().Builder.City.Name);
Assert.Equal("One L1", collection.First().Name);
}
Expand All @@ -335,7 +335,7 @@ public async void BuildingExpandBuilderTenantExpandCityOrderByBuilderNameSkip3Ta
void Test(ICollection<CoreBuilding> collection)
{
Assert.Null(options.Request.ODataFeature().TotalCount);
Assert.Equal(1, collection.Count);
Assert.Single(collection);
Assert.Equal("London", collection.First().Builder.City.Name);
Assert.Equal("One L1", collection.First().Name);
}
Expand Down
Loading

0 comments on commit d091a40

Please sign in to comment.