public async Task <Product> CreateAProduct(bool skipAddToCreateList = false, ProductCreateOption options = null)
        {
            var productService = new ProductService(Utils.AuthState);
            var obj            = await productService.CreateAsync(new Product
            {
                Name        = $"BizwebSharp Test Product #{Guid.NewGuid()}",
                Vendor      = "Auntie Dot",
                Content     = "<strong>This product was created while testing BizwebSharp!</strong>",
                ProductType = "Foobars",
                Alias       = Guid.NewGuid().ToString(),
                Images      = new List <ProductImage>
                {
                    new ProductImage
                    {
                        Base64 = "R0lGODlhAQABAIAAAAAAAAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=="
                    }
                },
            }, options);

            if (!skipAddToCreateList)
            {
                CreatedProducts.Add(obj);
            }

            return(obj);
        }
Beispiel #2
0
        /// <summary>
        /// Convenience function for running tests. Creates an object and automatically adds it to the queue for deleting after tests finish.
        /// </summary>
        public async Task <Product> Create(bool skipAddToCreateList = false, ProductCreateOption options = null)
        {
            var obj = await Service.CreateAsync(new Product()
            {
                Name        = Title,
                Vendor      = Vendor,
                Content     = Content,
                ProductType = ProductType,
                Alias       = Guid.NewGuid().ToString(),
                Images      = new List <ProductImage>
                {
                    new ProductImage
                    {
                        Base64 = "R0lGODlhAQABAIAAAAAAAAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=="
                    }
                },
            }, options);

            if (!skipAddToCreateList)
            {
                Created.Add(obj);
            }

            return(obj);
        }