Skip to content

Commit

Permalink
Some regression tests for OData related issues
Browse files Browse the repository at this point in the history
Resolves #23135
Resolves #24092
  • Loading branch information
maumar committed Oct 13, 2021
1 parent 1a3f625 commit a6d2f7e
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -80,5 +80,21 @@ public async Task Query_level_four()

Assert.Equal(10, levelFours.Count);
}

[ConditionalFact]
public async Task Query_count_expand_with_filter_contains()
{
var requestUri = $"{BaseAddress}/odata/LevelOne?$count=true&$expand=OneToOne_Required_FK1&$filter=OneToOne_Required_FK1/Id in (1)";
var request = new HttpRequestMessage(HttpMethod.Get, requestUri);
var response = await Client.SendAsync(request);

Assert.Equal(HttpStatusCode.OK, response.StatusCode);
var result = await response.Content.ReadAsObject<JObject>();

Assert.Contains("$metadata#LevelOne(OneToOne_Required_FK1())", result["@odata.context"].ToString());
Assert.Equal(1, result["@odata.count"]);
var projection = result["value"] as JArray;
Assert.Equal(11, projection.Count);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -79,5 +79,21 @@ public async Task Complex_query_with_any_on_collection_navigation()

Assert.Equal(3, officers.Count);
}

[ConditionalFact]
public async Task Query_with_expand_and_key_projection()
{
var requestUri = string.Format(@"{0}/odata/Gears?$select=SquadId&$expand=Tag($select=Id)", BaseAddress);
var request = new HttpRequestMessage(HttpMethod.Get, requestUri);
var response = await Client.SendAsync(request);

Assert.Equal(HttpStatusCode.OK, response.StatusCode);
var result = await response.Content.ReadAsObject<JObject>();

Assert.Contains("$metadata#Gears(SquadId,Tag(Id))", result["@odata.context"].ToString());
var projections = result["value"] as JArray;

Assert.Equal(5, projections.Count);
}
}
}

0 comments on commit a6d2f7e

Please sign in to comment.