예제 #1
0
        public async Task <IActionResult> RemoveCategory(string Id)
        {
            //Do code here
            Task <bool> is_valid = _adminGS.RemoveCategory(Id);

            if (is_valid.Result == false)
            {
                return(NotFound("No Category found with given Id"));
            }
            return(Ok("Deleted"));
        }
예제 #2
0
        public async Task <bool> TestFor_RemoveCategory()
        {
            //Arrange
            var res = false;

            //Action
            adminservice.Setup(repos => repos.RemoveCategory(_category.Id)).ReturnsAsync(true);
            var resultDelete = await _adminGroceryS.RemoveCategory(_category.Id);

            //Assertion
            if (resultDelete == true)
            {
                res = true;
            }
            //final result displaying in text file
            await File.AppendAllTextAsync("../../../../output_revised.txt", "TestFor_RemoveCategory=" + res + "\n");

            return(res);
        }
        public async Task <bool> Testfor_Validate_InValid_RemoveCategory()
        {
            //Arrange
            var res          = false;
            var _categorydel = new Category()
            {
            };

            //Action
            adminservice.Setup(repos => repos.RemoveCategory(_categorydel.Id)).ReturnsAsync(true);
            var result = await _adminGroceryS.RemoveCategory(_categorydel.Id);

            if (result == true)
            {
                res = true;
            }
            //Assert
            //final result displaying in text file
            await File.AppendAllTextAsync("../../../../output_exception_revised.txt", "Testfor_Validate_InValid_RemoveCategory=" + res + "\n");

            return(res);
        }