Automate HTTP POSTing JSON data using HTTPClient
As part of automating Integration Tests for WebAPI calls ,I used HTTPClient, Nunit and Json.NET . In this example i will demonstrate automating POST WebAPI call ( http://google:6789/api/appointment/book) and JSON data is posted to the WebAPI call. lets say appointmentId is returned as a response. [ Test ] public async Task BookAppointmentsWithValidTimeSlotTest() { int sampleLeadTime = 5; DateTime currentDateTime = DateTime .Today; int appointmentMonth = currentDateTime.Month; int appointmentYear = currentDateTime.Year; int appointmentDay = currentDateTime.Day + sampleLeadTime ; ...