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 1245779
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 1 deletion.
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);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ public async Task Query_orders_select_single_property()
Assert.Equal(830, orderDates.Count);
}

[ConditionalFact]
[ConditionalFact(Skip = "figure out custom routing")]
public async Task Basic_query_order_details()
{
var requestUri = $"{BaseAddress}/odata/Order Details";
Expand Down

0 comments on commit 1245779

Please sign in to comment.