public async void UpdateOrderEditSetCustomType() { var fields = CreateNewFields(); await WithType(client, async type => { await WithSimpleOrder(client, async order => { await WithUpdateableOrderEdit(client, draft => DefaultOrderEditDraftWithStagedAction(draft, order), async orderEdit => { Assert.NotNull(orderEdit); Assert.Single(orderEdit.StagedActions); var action = new SetCustomTypeUpdateAction { Type = type.ToKeyResourceIdentifier(), Fields = fields }; var updatedOrderEdit = await client .ExecuteAsync(orderEdit.UpdateById( actions => actions.AddUpdate(action))); Assert.Equal(type.Id, updatedOrderEdit.Custom.Type.Id); return(updatedOrderEdit); }); }); }); }
public async void UpdateOrderEditSetCustomField() { var fields = CreateNewFields(); var newValue = TestingUtility.RandomString(); await WithType(client, async type => { await WithSimpleOrder(client, async order => { await WithUpdateableOrderEdit(client, draft => DefaultOrderEditDraftWithStagedAction(draft, order), async orderEdit => { Assert.NotNull(orderEdit); Assert.Single(orderEdit.StagedActions); var action = new SetCustomTypeUpdateAction { Type = type.ToKeyResourceIdentifier(), Fields = fields }; var updatedOrderEdit = await client .ExecuteAsync(orderEdit.UpdateById( actions => actions.AddUpdate(action))); Assert.Equal(type.Id, updatedOrderEdit.Custom.Type.Id); //then set the custom field var setFieldAction = new SetCustomFieldUpdateAction() { Name = "string-field", Value = newValue }; var updatedOrderEditWithUpdatedCustomField = await client .ExecuteAsync(updatedOrderEdit.UpdateById( actions => actions.AddUpdate(setFieldAction))); Assert.Equal(newValue, updatedOrderEditWithUpdatedCustomField.Custom.Fields["string-field"]); return(updatedOrderEditWithUpdatedCustomField); }); }); }); }