Skip to content

Commit bb1d70e

Browse files
committed
Add E2E test
1 parent bdc4671 commit bb1d70e

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

test/Microsoft.Health.Fhir.Shared.Tests.E2E/Rest/Search/BasicSearchTests.cs

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,34 @@ public async Task GivenTooBigPostRequest_WhenSearching_ThenDontCrashServer()
199199
await Client.SearchPostAsync("Patient", null, default, ("name", sb.ToString()));
200200
}
201201

202+
/// <summary>
203+
/// Test to make sure we return Bad Request when customer sends too many parameters
204+
/// </summary>
205+
/// <returns>Task</returns>
206+
[Fact]
207+
[Trait(Traits.Priority, Priority.One)]
208+
[HttpIntegrationFixtureArgumentSets(dataStores: DataStore.SqlServer)]
209+
public async Task GivenTooParametersPostRequest_WhenSearching_ThenBadRequestIsReturned()
210+
{
211+
var sb = new StringBuilder();
212+
213+
// Create 2097 parameters
214+
for (int i = 1; i <= 2097; i++)
215+
{
216+
sb.Append(i);
217+
sb.Append(",");
218+
}
219+
220+
// Add the last one, 2098 parameters
221+
sb.Append("2098");
222+
223+
string ids = sb.ToString();
224+
using var response = await Assert.ThrowsAsync<FhirClientException>(async () => await Client.SearchPostAsync("ChargeItem", null, default, ("_id", ids)));
225+
226+
Assert.Equal(HttpStatusCode.BadRequest, response.StatusCode);
227+
Assert.Contains(Core.Resources.TooManyParameters, response.Message);
228+
}
229+
202230
/// <summary>
203231
/// This test is based on the details of user story #101268
204232
/// </summary>

0 commit comments

Comments
 (0)