public async Task UpdateCustomerByKeyChangeEmailAndSetFirstName() { await WithUpdateableCustomer(client, async customer => { var firstName = TestingUtility.RandomString(); var newEmail = $"joe{TestingUtility.RandomString()}@example.com"; var action1 = new ChangeEmailUpdateAction { Email = newEmail }; var action2 = new SetFirstNameUpdateAction { FirstName = firstName }; var updatedCustomer = await client .Builder() .Customers() .UpdateByKey(customer) .AddAction(action1) .AddAction(action2) .ExecuteAsync(); Assert.Equal(firstName, updatedCustomer.FirstName); Assert.Equal(newEmail, updatedCustomer.Email); return(updatedCustomer); }); }
public async Task UpdateCustomerByKeyChangeEmail() { await WithUpdateableCustomer(client, async customer => { var newEmail = $"joe{TestingUtility.RandomString()}@example.com"; var action = new ChangeEmailUpdateAction { Email = newEmail }; var updatedCustomer = await client .ExecuteAsync(customer.UpdateByKey(actions => actions.AddUpdate(action))); Assert.Equal(newEmail, updatedCustomer.Email); return(updatedCustomer); }); }