예제 #1
0
        public async Task DeletePartner_Ok()
        {
            Partner partner = TestDataFactory.GetPartner();

            var response = await httpTestClient.PostAsJsonAsync("/api/partners", partner);

            if (response.IsSuccessStatusCode)
            {
                partner    = JsonConvert.DeserializeObject <Partner>(await response.Content.ReadAsStringAsync());
                partner.Id = 0;

                response = await httpTestClient.DeleteAsync("/api/partners/" + partner.Id);

                Assert.True(response.StatusCode == HttpStatusCode.OK);
            }
        }
예제 #2
0
        public async Task UpdatePartner_InvalidId_Fail()
        {
            Partner partner = TestDataFactory.GetPartner();

            var response = await httpTestClient.PostAsJsonAsync("/api/partners", partner);

            if (response.IsSuccessStatusCode)
            {
                partner    = JsonConvert.DeserializeObject <Partner>(await response.Content.ReadAsStringAsync());
                partner.Id = 0;

                response = await httpTestClient.PutAsJsonAsync("/api/partners", partner);

                Assert.True(response.StatusCode == HttpStatusCode.BadRequest);
            }
        }