示例#1
0
        public async Task <ProductCategory> BuildAsync()
        {
            var headers = await _defaultRequestHeadersService.GetAsync();

            var id = await _productCategoriesClient.CreateAsync(_category, headers);

            return(await _productCategoriesClient.GetAsync(id, headers));
        }
        public async Task WhenCreate_ThenSuccess()
        {
            var headers = await _defaultRequestHeadersService.GetAsync();

            var categories = new ProductCategory
            {
                Id        = Guid.NewGuid(),
                Name      = "Test".WithGuid(),
                IsDeleted = false
            };

            var createdCategoryId = await _productCategoriesClient.CreateAsync(categories, headers);

            var createdCategory = await _productCategoriesClient.GetAsync(createdCategoryId, headers);

            Assert.NotNull(createdCategory);
            Assert.Equal(createdCategoryId, createdCategory.Id);
            Assert.Equal(categories.Name, createdCategory.Name);
            Assert.Equal(categories.IsDeleted, createdCategory.IsDeleted);
            Assert.True(createdCategory.CreateDateTime.IsMoreThanMinValue());
        }