Exemplo n.º 1
0
        public ContactGetModel UpdateContact(int id, string firstName, string surname)
        {
            // Create update model containing id (required) and only properties to be updated
            var contactUpdate = new ContactPatchModel
            {
                Id        = id,
                Firstname = firstName,
                Surname   = surname
            };

            // Update contact - throws an exception if not successful
            var updatedContact = _api.ContactClient.Update(contactUpdate).CheckResult();

            return(updatedContact);
        }
Exemplo n.º 2
0
 /// <inheritdoc/>
 public Task <ApiResult <ContactGetModel> > UpdateAsync(ContactPatchModel model, CancellationToken cancellationToken = default)
 {
     return(PatchAsync <ContactPatchModel, ContactGetModel>(model, cancellationToken));
 }
Exemplo n.º 3
0
        public void Update_SuccessfullyUpdatedContact()
        {
            // Arrange
            var contactPatchModel = new ContactPatchModel
            {
                AccountNumber          = "2626708763/1100",
                BankId                 = 63,
                City                   = "Bratislava",
                CompanyName            = "Solitea Slovensko, a.s.",
                CountryId              = 1,
                DefaultInvoiceMaturity = 9,
                DeliveryAddresses      = new List <DeliveryAddressPatchModel>
                {
                    new DeliveryAddressPatchModel
                    {
                        City       = "Brno",
                        Name       = "Money S5",
                        IsDefault  = false,
                        PostalCode = "60200",
                        Street     = "Okružní 732/5"
                    }
                },
                DiscountPercentage = 8,
                Email                     = "*****@*****.**",
                Fax                       = "+421 249 212 323",
                Firstname                 = "A.",
                Iban                      = "SK13 1100 0000 0026 2670 8763",
                Id                        = _newContactId,
                IdentificationNumber      = "36237337",
                IsRegisteredForVatOnPay   = true,
                Mobile                    = "+421 905 123 456",
                Note                      = "nic",
                Phone                     = "+421 249 212 323",
                PostalCode                = "821 09",
                SendReminders             = true,
                Street                    = "Plynárenská 7/C",
                Surname                   = "B.",
                Swift                     = "TATRSKBX",
                Title                     = "Mgr.",
                VatIdentificationNumber   = string.Empty,
                VatIdentificationNumberSk = "SK2020193890",
                Www                       = "www.solitea.sk"
            };

            // Act
            var data = ContactClient.Update(contactPatchModel).AssertResult();

            _dateLastChange = data.Metadata.DateLastChange;

            // Assert
            Assert.AreEqual(contactPatchModel.Id, data.Id);
            Assert.AreEqual(contactPatchModel.AccountNumber, data.AccountNumber);
            Assert.AreEqual(contactPatchModel.BankId.Value, data.BankId);
            Assert.AreEqual(contactPatchModel.City, data.City);
            Assert.AreEqual(contactPatchModel.CompanyName, data.CompanyName);
            Assert.AreEqual(contactPatchModel.CountryId, data.CountryId);
            Assert.AreEqual(contactPatchModel.DefaultInvoiceMaturity.Value, data.DefaultInvoiceMaturity);
            AssertDeliveryAddress(data.DeliveryAddresses.First(), contactPatchModel.DeliveryAddresses.First());
            Assert.AreEqual(contactPatchModel.DiscountPercentage, data.DiscountPercentage);
            Assert.AreEqual(contactPatchModel.Email, data.Email);
            Assert.AreEqual(contactPatchModel.Fax, data.Fax);
            Assert.AreEqual(contactPatchModel.Firstname, data.Firstname);
            Assert.AreEqual(contactPatchModel.Iban, data.Iban);
            Assert.AreEqual(contactPatchModel.IdentificationNumber, data.IdentificationNumber);
            Assert.AreEqual(false, data.IsRegisteredForVatOnPay);
            Assert.AreEqual(contactPatchModel.Mobile, data.Mobile);
            Assert.AreEqual(contactPatchModel.Note, data.Note);
            Assert.AreEqual(contactPatchModel.Phone, data.Phone);
            Assert.AreEqual(contactPatchModel.PostalCode, data.PostalCode);
            Assert.AreEqual(contactPatchModel.SendReminders, data.SendReminders);
            Assert.AreEqual(contactPatchModel.Street, data.Street);
            Assert.AreEqual(contactPatchModel.Surname, data.Surname);
            Assert.AreEqual(contactPatchModel.Swift, data.Swift);
            Assert.AreEqual(contactPatchModel.VatIdentificationNumber, data.VatIdentificationNumber);
            Assert.AreEqual(contactPatchModel.VatIdentificationNumberSk, data.VatIdentificationNumberSk);
            Assert.AreEqual(contactPatchModel.Www, data.Www);
        }
Exemplo n.º 4
0
 /// <inheritdoc/>
 public ApiResult <ContactGetModel> Update(ContactPatchModel model)
 {
     return(Patch <ContactPatchModel, ContactGetModel>(model));
 }