public async Task InitializeAsync()
        {
            var policy = new SmartRetryExecutionPolicy();

            Service.SetExecutionPolicy(policy);
            CustomCollectionService.SetExecutionPolicy(policy);
            ProductService.SetExecutionPolicy(policy);

            // Create a custom collection to use with these tests.
            var collection = await CustomCollectionService.CreateAsync(new CustomCollection()
            {
                Title     = "Things",
                Published = false,
                BodyHtml  = "<h1>Hello from ShopifySharp</h1>",
                Image     = new CustomCollectionImage()
                {
                    Src = "http://placehold.it/250x250"
                }
            });

            CollectionId = collection.Id.Value;

            // Create a collection to use with get, list, count, etc. tests.
            await Create();
        }
Exemple #2
0
        public async Task InitializeAsync()
        {
            var policy = new LeakyBucketExecutionPolicy();

            Service.SetExecutionPolicy(policy);
            CollectService.SetExecutionPolicy(policy);
            ProductService.SetExecutionPolicy(policy);
            CustomCollectionService.SetExecutionPolicy(policy);

            // Create a custom collection to use with these tests.
            var collection = await CustomCollectionService.CreateAsync(new CustomCollection()
            {
                Title     = "Things",
                Published = false,
                BodyHtml  = "<h1>Hello from ShopifySharp</h1>",
                Image     = new CustomCollectionImage()
                {
                    Attachment = "R0lGODlhAQABAIAAAAAAAAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=="
                }
            });

            CollectionId = collection.Id.Value;

            // Create a collection to use with get, list, count, etc. tests.
            await Create();
        }
Exemple #3
0
        static public CustomCollection CreateCustomCollection(string collection)
        {
            CustomCollectionService service = CustomCollectionService;

            collection = collection.Trim();
            IEnumerable <CustomCollection> customs = service.ListAsync().Result;

            CustomCollection cc = customs.FirstOrDefault(c => c.Title == collection && c.PublishedScope != "global");

            if (cc != null)
            {
                //				service.DeleteAsync(cc.Id.Value).Wait();
            }


            //			customs = service.ListAsync().Result;
            if (customs.All(c => c.Title != collection))
            {
                string handle = collection.Replace(" ", "").Replace('&', '-');
                cc = new CustomCollection()
                {
                    Title          = collection,
                    Handle         = handle,
                    PublishedScope = "global",
                    BodyHtml       = "",
                    Published      = true,
                    PublishedAt    = DateTime.UtcNow,
                    SortOrder      = "alpha-asc"
                };
                cc = service.CreateAsync(cc).Result;
            }
            return(cc);
        }
Exemple #4
0
        private async Task <CustomCollection> AddColletion(string title)
        {
            var service = new CustomCollectionService(shopifyUrl, shopifyTokenAcces);

            return(await service.CreateAsync(new CustomCollection()
            {
                Title = title,
                Published = true,
                PublishedAt = DateTime.UtcNow
            }));
        }
        public async Task InitializeAsync()
        {
            var policy = new LeakyBucketExecutionPolicy();

            Service.SetExecutionPolicy(policy);
            CustomCollectionService.SetExecutionPolicy(policy);
            ProductService.SetExecutionPolicy(policy);

            // Create a collection to use with these tests.
            var collection = await CustomCollectionService.CreateAsync(new CustomCollection()
            {
                Title     = "Things",
                Published = false,
                Image     = new CustomCollectionImage()
                {
                    Src = "http://placehold.it/250x250"
                }
            });

            CollectionId = collection.Id.Value;

            // Create a collection to use with get, list, count, etc. tests.
            await Create();
        }