public Type CreateNewType()
        {
            Type type = this.typeFixture.CreateType();

            this.typeFixture.TypesToDelete.Add(type);
            return(type);
        }
Exemplo n.º 2
0
        public Type CreateCustomType()
        {
            Type customType = this.typeFixture.CreateType();

            this.typeFixture.TypesToDelete.Add(customType);
            return(customType);
        }
        private CustomFieldsDraft CreateCustomFieldsDraft()
        {
            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();
            return(customFieldsDraft);
        }
        public static CartDraft DefaultCartDraftWithCustomType(CartDraft draft, Type type, Fields fields)
        {
            var customFieldsDraft = new CustomFieldsDraft
            {
                Type   = type.ToKeyResourceIdentifier(),
                Fields = fields
            };

            var cartDraft = DefaultCartDraft(draft);

            cartDraft.Custom = customFieldsDraft;

            return(cartDraft);
        }
Exemplo n.º 5
0
        public InventoryEntryDraft CreateInventoryEntryDraftWithCustomFields()
        {
            InventoryEntryDraft draft             = this.GetInventoryEntryDraft();
            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);
        }
        public static DiscountCodeDraft DefaultDiscountCodeDraftWithCustomType(DiscountCodeDraft draft,
                                                                               Type type, Fields fields)
        {
            var customFieldsDraft = new CustomFieldsDraft
            {
                Type   = type.ToKeyResourceIdentifier(),
                Fields = fields
            };

            var discountCodeDraft = DefaultDiscountCodeDraft(draft);

            discountCodeDraft.Custom = customFieldsDraft;

            return(discountCodeDraft);
        }
        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);
        }
        public static async Task WithUpdateableDiscountCodeWithCustomType(IClient client,
                                                                          Type type, Fields fields, Func <DiscountCode, Task <DiscountCode> > func)
        {
            await WithCartDiscount(client, DefaultCartDiscountDraftRequireDiscountCode, async cartDiscount =>
            {
                var cartDiscounts = new List <Reference <CartDiscount> >()
                {
                    new Reference <CartDiscount> {
                        Id = cartDiscount.Id
                    }
                };

                await WithUpdateableAsync(client,
                                          DefaultDiscountCodeDraftWithCartDiscounts(new DiscountCodeDraft(), cartDiscounts),
                                          discountCodeDraft =>
                                          DefaultDiscountCodeDraftWithCustomType(discountCodeDraft, type, fields), func);
            });
        }
Exemplo n.º 9
0
        public CategoryDraft GetCategoryDraftWithCustomFields()
        {
            Category relatedCategory = this.CreateCategory(this.GetCategoryDraft());

            this.CategoriesToDelete.Add(relatedCategory);
            CategoryDraft     categoryDraft     = this.GetCategoryDraft();
            CustomFieldsDraft customFieldsDraft = new CustomFieldsDraft();
            Type type = this.typeFixture.CreateType();

            this.typeFixture.TypesToDelete.Add(type);
            customFieldsDraft.Type = new ResourceIdentifier <Type> {
                Key = type.Key
            };
            customFieldsDraft.Fields = new Fields();
            customFieldsDraft.Fields.Add("string-field", "test");
            customFieldsDraft.Fields.Add("localized-string-field",
                                         new LocalizedString()
            {
                { "en", "localized-string-field-value" }
            });
            customFieldsDraft.Fields.Add("enum-field", "enum-key-1");
            customFieldsDraft.Fields.Add("localized-enum-field", "enum-key-1");
            customFieldsDraft.Fields.Add("number-field", 3);
            customFieldsDraft.Fields.Add("boolean-field", true);
            customFieldsDraft.Fields.Add("date-field", new DateTime(2018, 11, 28));
            customFieldsDraft.Fields.Add("date-time-field", new DateTime(2018, 11, 28, 11, 01, 00));
            customFieldsDraft.Fields.Add("time-field", new TimeSpan(11, 01, 00));
            customFieldsDraft.Fields.Add("money-field", new Money()
            {
                CentAmount = 1800, CurrencyCode = "EUR"
            });
            customFieldsDraft.Fields.Add("set-field", new FieldSet <string>()
            {
                "test1", "test2"
            });
            customFieldsDraft.Fields.Add("reference-field", new Reference <Category>()
            {
                Id = relatedCategory.Id
            });
            categoryDraft.Custom = customFieldsDraft;
            return(categoryDraft);
        }
Exemplo n.º 10
0
        public static InventoryEntryDraft DefaultInventoryEntryDraftWithCustomType(InventoryEntryDraft draft, Type type, Fields fields)
        {
            var customFieldsDraft = new CustomFieldsDraft
            {
                Type   = type.ToKeyResourceIdentifier(),
                Fields = fields
            };

            var inventoryEntryDraft = DefaultInventoryEntryDraft(draft);

            inventoryEntryDraft.Custom = customFieldsDraft;

            return(inventoryEntryDraft);
        }
        public static ShoppingListDraft DefaultShoppingListDraftWithCustomType(ShoppingListDraft draft, Type type, Fields fields)
        {
            var customFieldsDraft = new CustomFieldsDraft
            {
                Type   = type.ToKeyResourceIdentifier(),
                Fields = fields
            };

            var shoppingListDraft = DefaultShoppingListDraft(draft);

            shoppingListDraft.Custom = customFieldsDraft;

            return(shoppingListDraft);
        }
        public static CategoryDraft DefaultCategoryDraftWithAssetWithCustomType(CategoryDraft draft, Type type, Fields fields)
        {
            var customFieldsDraft = new CustomFieldsDraft
            {
                Type   = type.ToKeyResourceIdentifier(),
                Fields = fields
            };
            var categoryDraft = DefaultCategoryDraft(draft);
            var assetDraft    = TestingUtility.GetAssetDraft();

            assetDraft.Custom    = customFieldsDraft;
            categoryDraft.Assets = new List <AssetDraft> {
                assetDraft
            };
            return(categoryDraft);
        }
        public static ReviewDraft DefaultReviewDraftWithCustomType(ReviewDraft draft, Type type, Fields fields)
        {
            var customFieldsDraft = new CustomFieldsDraft
            {
                Type   = type.ToKeyResourceIdentifier(),
                Fields = fields
            };

            var reviewDraft = DefaultReviewDraft(draft);

            reviewDraft.Custom = customFieldsDraft;

            return(reviewDraft);
        }