Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some regression tests for OData related issues #26324

Merged
1 commit merged into from
Oct 13, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.Single(projection);
}
}
}
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);
}
}
}