public void ThenIWillGetUserInformationWithEmailAndPassword() { var response = RestAPIHelper.GetResponse(); var content = response.Content; Assert.That(content.Contains("token")); }
public void ThenIShouldGetBackInformationOfAllPostcodesChosen() { /// -- Test Currently failing -- /// apiResponse = RestAPIHelper.GetResponse(); postCodeResponse = Newtonsoft.Json.JsonConvert.DeserializeObject <PostCodeResponse>(apiResponse.Content); Assert.That(postCodeResponse.status, Is.EqualTo(200), "Test StatusCode Not 200"); }
public void ThenIGetAPIResponseInJsonFormat() { var apiResponse = RestAPIHelper.GetResponse(); dynamic responseContent = JsonConvert.DeserializeObject <dynamic>(apiResponse.Content); Assert.That(apiResponse.StatusCode == HttpStatusCode.OK && responseContent.Count != 0); }
public void ThenIWillGetWithError() { var response = RestAPIHelper.GetResponse(); Assert.That(response.Content.Contains("error") && response.Content.Contains("Missing password") && (response.StatusCode == HttpStatusCode.BadRequest)); }
public void ThenIGetAPIResponseAsUserNotFound() { var resturl = api.SetUrl("api/users/23"); var request = api.CreateRequest(); var response = api.GetResponse(resturl, request); UserResponse content = api.GetContent <UserResponse>(response); Assert.AreEqual(HttpStatusCode.NotFound, response.StatusCode, "404 Not Found"); }
public int GetResponseStatusCode() { int count = 0; int statusCode = (int)restHelper.GetResponse().StatusCode; while (statusCode == 0) { statusCode = (int)restHelper.GetResponse().StatusCode; Thread.Sleep(500); count++; if (count == 5) { break; } } return(statusCode); }
public void ThenIShouldGetBackTheCorrectResponseInJsonFormat() { var StatusCode = "200 OK"; var response = RestAPIHelper.GetResponse(); if (response.StatusCode == System.Net.HttpStatusCode.OK) { Assert.That(response.StatusCode, Is.EqualTo(StatusCode), "Returned result not as expected"); } }
public void ThenIShouldGetBackInformationOfMyChosenPostcode() { apiResponse = RestAPIHelper.GetResponse(); postCodeResponse = Newtonsoft.Json.JsonConvert.DeserializeObject <PostCodeResponse>(apiResponse.Content); responsePostCode = postCodeResponse.result.postcode; originalSpacePostcode = GenericHelper.stringSpaceConveter(inputPostcodes); responseSpacePostecode = GenericHelper.responseSpaceConverter(responsePostCode); //--ToDo Move Assertions to the Assertions Folder --// Assert.That(postCodeResponse.status, Is.EqualTo(200), "Test StatusCode Not 200"); Assert.That(responseSpacePostecode, Is.EqualTo(originalSpacePostcode)); }
public void ThenIShouldGetTheCorrectAPIResponseInJsonFormat() { var expected = "something"; //something is a placeholder var response = RestAPIHelper.GetResponse(); if (response.StatusCode == System.Net.HttpStatusCode.OK) { Assert.That(response.Content, Is.EqualTo(expected), "Error Message"); } }
public void ThenIGetAPIResponseInJsonFormat() { var resturl = api.SetUrl("api/users/2"); var request = api.CreateRequest(); var response = api.GetResponse(resturl, request); UserResponse content = api.GetContent <UserResponse>(response); Assert.AreEqual(HttpStatusCode.OK, response.StatusCode, "200 OK"); Assert.That(content.Data.first_name, Does.Contain("Janet")); Assert.That(content.Data.last_name, Does.Contain("Weaver")); }
public void WhenWeCreateAUser() { var requestBody = new PostUserRequest() { Name = firstName, Job = job }; var request = api.CreatePostRequest <PostUserRequest>(requestBody); var resturl = api.SetUrl("api/users"); var response = api.GetResponse(resturl, request); UserResponse content = api.GetContent <UserResponse>(response); }
public List <string> GetAllModelsColorApiResponse(string brand, string year, string dealerid) { List <string> modelsSeoName = new List <string>(); RestAPIHelper.SetUrl(CPQEndpointBuilder.GetDealerExpModelsEnpointByBrandYear(brand, year, dealerid)); RestAPIHelper.CreateGetRequest(); if (GetResponseStatusCode() == API_SUCCESS_RESPONSE_CODE) { var deserialized = SimpleJson.SimpleJson.DeserializeObject <List <Variant> >(RestAPIHelper.GetResponse().Content); for (int i = 0; i < deserialized.Count; i++) { string fullBuildUrl = deserialized[i].BuildURL; int index = GetNthIndex(fullBuildUrl, '/', 4); string partialBuildUrl = fullBuildUrl.Substring(index + 1); string modelColorUrl = partialBuildUrl.Substring(0, partialBuildUrl.IndexOf("/")); modelsSeoName.Add(modelColorUrl); } } return(modelsSeoName); }
public void ThenIGetResponseInJsonFormat() { var response = RestAPIHelper.GetResponse(); Console.WriteLine(response.Content); }
public void ThenIWillBeRegisteredSuccessfully() { var response = RestAPIHelper.GetResponse(); Assert.That(response.StatusCode, Is.EqualTo(201), "User not registered successfully"); }
public void ThenIWillGetUserAccountInformation() { var response = RestAPIHelper.GetResponse(); }