示例#1
0
        public async Task PostGuests()
        {
            var guest = new GostDTO()
            {
                Ime     = "Guesz1",
                Prezime = "Guser",
                Adresa  = "AA",
                Email   = "BB"
            };

            var content = new StringContent(JsonConvert.SerializeObject(guest), Encoding.UTF8, "application/json");

            using (var response = await client.PostAsync("api/Gost/Create", content))
            {
                var id = await response.Content.ReadAsStringAsync();

                int parseID = int.Parse(id);
                Assert.AreEqual(HttpStatusCode.Created, response.StatusCode, "The guest has an invalid model state");
                await client.DeleteAsync($"api/Gost/Delete/{parseID}");
            }
        }