public void VerifyHTTPResponseBody() { var json = RestAPIUtil.GetResponseBody(Config.UrlToJSON); JArray jsonObjects = JArray.Parse(json); Assert.IsTrue(jsonObjects.Count == int.Parse(Config.CountOfUsers), Resource.IncorectCountofUserInJSON); }
public void VerifyHTTPResponseHeader() { var response = RestAPIUtil.GetResponse(Config.UrlToJSON); var contentTypeOfResponse = response.GetResponseHeader("Content-Type"); var softAssert = new SoftAssertions(); softAssert.That(!string.IsNullOrWhiteSpace(contentTypeOfResponse), Resource.ContentTypeIsNull); softAssert.That(contentTypeOfResponse.Equals(Resource.ValueOfContentType, StringComparison.InvariantCultureIgnoreCase), string.Format(Resource.IncorrectContentType, Resource.ValueOfContentType)); softAssert.AssertAll(); }
public void VerifyStatusCode() { var response = RestAPIUtil.GetResponse(Config.UrlToJSON); Assert.IsTrue(response.StatusCode == HttpStatusCode.OK, Resource.IncorrectStatusCode); }