Skip to content

Commit 12c4658

Browse files
another crime i think
1 parent 581b87d commit 12c4658

1 file changed

Lines changed: 19 additions & 1 deletion

File tree

TransactionProcessor.Mobile.UITests/Steps/SharedSteps.cs

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,25 @@ public async Task GivenTheFollowingUsersAreAvailableAtThePataPawaPrePayHost(Data
342342
public async Task GivenTheFollowingMetersAreAvailableAtThePataPawaPrePayHost(DataTable table)
343343
{
344344
List<ReqnrollExtensions.PataPawaMeter> meters = table.Rows.ToPataPawaMeters();
345-
await this.TransactionProcessorSteps.GivenTheFollowingMetersAreAvailableAtThePataPawaPrePaidHost(meters);
345+
await this.GivenTheFollowingMetersAreAvailableAtThePataPawaPrePaidHost(meters);
346+
}
347+
348+
public async Task GivenTheFollowingMetersAreAvailableAtThePataPawaPrePaidHost(List<ReqnrollExtensions.PataPawaMeter> meters)
349+
{
350+
await this.SendRequestToTestHost<ReqnrollExtensions.PataPawaMeter>(meters, "/api/developer/patapawaprepay/createmeter");
351+
}
352+
353+
public async Task SendRequestToTestHost<T>(List<T> objects, String url)
354+
{
355+
foreach (T o in objects)
356+
{
357+
HttpRequestMessage httpRequestMessage = new HttpRequestMessage(HttpMethod.Post, url);
358+
359+
httpRequestMessage.Content = new StringContent(StringSerialiser.Serialise(o, new SerialiserOptions(SerialiserPropertyFormat.CamelCase)), Encoding.UTF8, "application/json");
360+
361+
HttpResponseMessage response = await this.TestingContext.DockerHelper.TestHostHttpClient.SendAsync(httpRequestMessage);
362+
response.StatusCode.ShouldBe(HttpStatusCode.OK);
363+
}
346364
}
347365
}
348366
}

0 commit comments

Comments
 (0)