Ejemplo n.º 1
0
 // Reusable method to delete a PaymentType from the database
 public async Task deleteDummyPaymentType(PaymentType PaymentTypeToDelete)
 {
     using (HttpClient client = new APIClientProvider().Client)
     {
         HttpResponseMessage deleteResponse = await client.DeleteAsync($"{url}/{PaymentTypeToDelete.id}");
     }
 }
 public async Task DeleteDummyEmployee(Employee EmployeeToDelete)
 {
     using (HttpClient client = new APIClientProvider().Client)
     {
         HttpResponseMessage deleteResponse = await client.DeleteAsync($"{url}/{EmployeeToDelete.Id}");
     }
 }
 //Method to Delete the Dummy Product After its created
 public async Task deleteDummyProduct(Product productToDelete)
 {
     using (HttpClient client = new APIClientProvider().Client)
     {
         HttpResponseMessage deleteResponse = await client.DeleteAsync($"{url}/{productToDelete.Id}");
     }
 }
        public async Task Test_Delete_NonExistent_Order_Fails()
        {
            using (var client = new APIClientProvider().Client)
            {
                // Try to delete an Id that shouldn't exist
                HttpResponseMessage deleteResponse = await client.DeleteAsync($"{url}0000000000");

                Assert.False(deleteResponse.IsSuccessStatusCode);
                Assert.Equal(HttpStatusCode.NotFound, deleteResponse.StatusCode);
            }
        }