public static CustomerGroupDraft DefaultCustomerGroupDraftWithKey(CustomerGroupDraft draft, string key) { var customerGroupDraft = DefaultCustomerGroupDraft(draft); customerGroupDraft.Key = key; return(customerGroupDraft); }
public CustomerGroup CreateCustomerGroupWithCustomFields() { CustomerGroupDraft draft = this.CreateCustomerGroupDraftWithCustomFields(); IClient commerceToolsClient = this.GetService <IClient>(); CustomerGroup customerGroup = commerceToolsClient.ExecuteAsync(new CreateCommand <CustomerGroup>(draft)).Result; return(customerGroup); }
public CustomerGroupDraft CreateCustomerGroupDraft() { CustomerGroupDraft draft = new CustomerGroupDraft(); draft.GroupName = TestingUtility.RandomString(10); draft.Key = TestingUtility.RandomString(10); return(draft); }
public static CustomerGroupDraft DefaultCustomerGroupDraft(CustomerGroupDraft customerGroupDraft) { var randomInt = TestingUtility.RandomInt(); customerGroupDraft.Key = $"Key{randomInt}"; customerGroupDraft.GroupName = $"Group{randomInt}"; return(customerGroupDraft); }
public CustomerGroupDraft CreateCustomerGroupDraft() { CustomerGroupDraft draft = new CustomerGroupDraft(); draft.GroupName = this.RandomString(10); draft.Key = this.RandomString(10); return(draft); }
/// <summary> /// Gets a test customerGroup draft. /// </summary> /// <returns>CustomerGroupDraft</returns> public static CustomerGroupDraft GetTestCustomerGroupDraft() { string key = GetRandomString(10); var groupName = $"CustomerGroup_{key}"; var customerGroupDraft = new CustomerGroupDraft(groupName, key); return(customerGroupDraft); }
public void CreateCustomerGroupWithCustomFields() { CustomerGroupDraft draft = this.customerGroupFixture.CreateCustomerGroupDraftWithCustomFields(); IClient commerceToolsClient = this.customerGroupFixture.GetService <IClient>(); CustomerGroup customerGroup = commerceToolsClient.ExecuteAsync(new CreateCommand <CustomerGroup>(draft)).Result; this.customerGroupFixture.CustomerGroupsToDelete.Add(customerGroup); Assert.Equal(draft.Custom.Fields.Count, customerGroup.Custom.Fields.Count); }
public static CustomerGroupDraft DefaultCustomerGroupDraftWithCustomType(CustomerGroupDraft draft, Type type, Fields fields) { var customFieldsDraft = new CustomFieldsDraft { Type = type.ToKeyResourceIdentifier(), Fields = fields }; var customerGroupDraft = DefaultCustomerGroupDraft(draft); customerGroupDraft.Custom = customFieldsDraft; return(customerGroupDraft); }
public CustomerGroupDraft CreateCustomerGroupDraftWithCustomFields() { CustomerGroupDraft draft = new CustomerGroupDraft(); draft.GroupName = TestingUtility.RandomString(10); draft.Key = TestingUtility.RandomString(10); CustomFieldsDraft customFieldsDraft = new CustomFieldsDraft(); Type type = this.typeFixture.CreateType(); this.typeFixture.TypesToDelete.Add(type); customFieldsDraft.Type = new ResourceIdentifier <Type> { Key = type.Key }; customFieldsDraft.Fields = this.CreateNewFields(); draft.Custom = customFieldsDraft; return(draft); }