Exemplo n.º 1
0
        public async void TestAddCounterparty_Success()
        {
            string phone = "+4412345678908";

            var counterparties = await _counterpartiesApiClient.GetCounterparties();

            if (counterparties.Exists(x => x.Phone == phone))
            {
                throw new Exception($"Counterparty with {phone} alredy exsists");
            }

            AddCounterpartyReq req = new AddCounterpartyReq
            {
                ProfileType = ProfileType.PERSONAL,
                Name        = "John Smith",
                Phone       = phone
            };

            Result <AddCounterpartyResp> resp = await _counterpartiesApiClient.CreateCounterparty(req);

            Assert.NotNull(resp);

            var resp2 = await _counterpartiesApiClient.DeleteCounterparty(resp.Value.Id);

            Assert.True(resp2);
        }
        public async Task TestDeleteCounterparty_Success()
        {
            var    phone = "+4412345678908";
            string counterpartyId;

            var counterparties = await _counterpartiesApiClient.GetCounterparties();

            Assert.NotNull(counterparties);

            await Task.Delay(2000);

            counterpartyId = counterparties?.FirstOrDefault(x => x.Phone == phone)?.Id;
            if (counterpartyId == null)
            {
                var req = new AddCounterpartyReq
                {
                    ProfileType = ProfileType.Personal,
                    Name        = "John Smith",
                    Phone       = phone
                };

                var counterparty = await _counterpartiesApiClient.CreateCounterparty(req);

                Assert.NotNull(counterparty);
                counterpartyId = counterparty.Value.Id;
            }

            await Task.Delay(2000);

            var resp = await _counterpartiesApiClient.DeleteCounterparty(counterpartyId);

            Assert.True(resp);
        }