Пример #1
0
        public async Task <IActionResult> Updatecategory(string Id, [FromBody] Category category)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest());
            }
            var getcategory = _groceryServices.GetCategoryById(Id);

            if (getcategory == null)
            {
                return(NotFound());
            }
            await _groceryServices.UpdateCategory(Id, category);

            return(Ok("Category Updated..."));
        }
        public async Task <bool> Testfor_Validate_GetCategoryById()
        {
            //Arrange
            bool res = false;

            //Act
            groceryservice.Setup(repo => repo.GetCategoryById(_category.Id)).ReturnsAsync(_category);
            var result = await _groceryS.GetCategoryById(_category.Id);

            if (result != null)
            {
                res = true;
            }
            //Asert
            //final result displaying in text file
            await File.AppendAllTextAsync("../../../../output_revised.txt", "Testfor_Validate_GetCategoryById=" + res + "\n");

            return(res);
        }