public DeleteWrestlerResponse DeleteWrestler(DeleteWrestlerRequest request) { string url = string.Format("php/wrestler/delete.php?id={0}", request.Id); var response = _client.DeleteMethod(url); if (response.StatusCode == HttpStatusCode.OK) return JsonConvert.DeserializeObject<DeleteWrestlerResponse>(response.Content); if (response.StatusCode == HttpStatusCode.NotFound) { throw new NotFoundException(response.StatusCode); } return null; }
public void When_UserDoesNotExistInDB_Expect_UserNotFoundError() { //Assign int testId = 0000; var client = new WrestlerClient("auto", "test"); var request = new DeleteWrestlerRequest { Id = testId }; //Act var response = client.DeleteWrestler(request); }
public void When_PassNegativeId_Expect_UserNotFoundError() { //Assign int testId = -666; var client = new WrestlerClient("auto", "test"); var request = new DeleteWrestlerRequest { Id = testId }; //Act var response = client.DeleteWrestler(request); }
public void When_UserExistInDB_Expect_SuccessfulDeletion() { //Assign int testId = 3792; var client = new WrestlerClient("auto", "test"); var request = new DeleteWrestlerRequest { Id = testId }; //Act var response = client.DeleteWrestler(request); //Assert Assert.IsNotNull(response); Assert.IsTrue(response.result); }