Пример #1
0
        public async Task AddClient()
        {
            var client = new IndividualClientDTO
            {
                Name       = "Anna Kowalska2",
                EMail      = "*****@*****.**",
                Street     = "Mazowiecka 12a",
                City       = "Kozienice",
                PostalCode = "09-678",
                TypeId     = 1
            };

            var json = JsonConvert.SerializeObject(client);


            var handleRequest = await httpClient.PostAsync("http://*****:*****@a.com", result.EMail);
            Assert.AreEqual("Mazowiecka 12a", result.Street);
            Assert.AreEqual("Kozienice", result.City);
            Assert.AreEqual("09-678", result.PostalCode);
            Assert.AreEqual(1, result.TypeId);
        }
Пример #2
0
        public async Task UpdateClient()
        {
            int id       = 4;
            var response = await httpClient.GetAsync("http://*****:*****@a.com", result.EMail);
            Assert.AreEqual("Dluga 3", result.Street);
            Assert.AreEqual("Krakow", result.City);
            Assert.AreEqual("11169", result.PostalCode);

            var updatedClient = new IndividualClientDTO
            {
                ID         = 4,
                Name       = "Changed",
                EMail      = "*****@*****.**",
                Street     = "Zielonkawa 2",
                City       = "Kozienice2",
                PostalCode = "22-222",
                TypeId     = 1,
            };

            var json = JsonConvert.SerializeObject(updatedClient);

            var change = await httpClient.PutAsync("http://*****:*****@a.com", changedClient.EMail);
            Assert.AreEqual("Zielonkawa 2", changedClient.Street);
            Assert.AreEqual("Kozienice2", changedClient.City);
            Assert.AreEqual("22-222", changedClient.PostalCode);
            Assert.AreEqual(1, changedClient.TypeId);
        }