Exemple #1
0
        public async Task TestDelete_NoContent()
        {
            using (var client = new TestClientProvider().Client)
            {
                var response = await client.PostAsync(RequestUri,
                                                      new StringContent(
                                                          JsonConvert.SerializeObject(new Realtor()
                {
                    Id = 6,
                    Firstname = "Firstname2",
                    Lastname = "Lastname2",
                    CreatedDateTime = DateTime.Now,
                }
                                                                                      ),
                                                          Encoding.UTF8,
                                                          "application/json"
                                                          )
                                                      );

                response = await client.DeleteAsync(RequestUri + "/6");

                response.EnsureSuccessStatusCode();
                Assert.Equal(HttpStatusCode.NoContent, response.StatusCode);
            }
        }
Exemple #2
0
        public async Task TestDelete_NotFound()
        {
            using (var client = new TestClientProvider().Client)
            {
                var response = await client.PostAsync(RequestUri,
                                                      new StringContent(
                                                          JsonConvert.SerializeObject(new Division()
                {
                    Id = 4,
                    Name = "Division1",
                    CreatedDateTime = DateTime.Now,
                }
                                                                                      ),
                                                          Encoding.UTF8,
                                                          "application/json"
                                                          )
                                                      );

                response = await client.DeleteAsync(RequestUri + "/5");

                Assert.Equal(HttpStatusCode.NotFound, response.StatusCode);
            }
        }