Esempio n. 1
0
        private async Task CreateCategoryAsync()
        {
            if (CreateValidationsRef.ValidateAll())
            {
                await CategoryAppService.CreateAsync(NewCategory);
                await GetCategorysAsync();

                CreateCategoryModal.Hide();
            }
        }
        public async Task Should_Able_To_Create_A_Category()
        {
            var categoryCreateDto = new CategoryCreateDto
            {
                CategoryName        = "Corn bread yummy",
                CategoryDescription = "Corn break from sri lankan farms",
                ThumbnailBase64     = Convert.ToBase64String(TestDataProvider.GetPicture())
            };

            var categoryDto = await CategoryAppService.CreateAsync(categoryCreateDto);

            categoryDto.ShouldNotBeNull();

            categoryDto.Id.ShouldBeGreaterThan(0);
            categoryDto.CategoryName.ShouldBe(categoryCreateDto.CategoryName);
            categoryDto.CategoryDescription.ShouldBe(categoryCreateDto.CategoryDescription);
            categoryDto.CategoryThumbnail.ShouldNotBeNullOrEmpty();
            categoryDto.CategoryThumbnail.ShouldNotBeNullOrWhiteSpace();
        }
Esempio n. 3
0
 public async Task <CategoryDto> Create([FromBody] CategoryCreateDto dto)
 {
     return(await CategoryAppService.CreateAsync(dto));
 }