Example #1
0
        //[Test]
        //[Category("ActiveDataTest")]
        //[ExpectedException(typeof(System.Data.Entity.Infrastructure.DbUpdateException))]
        public void Test_DeleteActive_Failure()
        {
            var category = _catProvider.GetCategories().Where(w => w.CategoryName == "UnityTestCat_ActiveTest").FirstOrDefault();

            Assert.IsNotNull(category);

            var result = _catProvider.DeleteCategory(category);

            Assert.AreEqual(result, 1);
        }
Example #2
0
 public void Cleanup()
 {
     foreach (string cat in _catToAdd)
     {
         var category = _catProvider.GetCategories().Where(w => w.CategoryName == cat).FirstOrDefault();
         var result   = _catProvider.DeleteCategory(category);
     }
 }
        //[Test]
        //[Category("CategoryDataTest")]
        public void TestMethod_DeleteCategory()
        {
            var category = _catProvider.GetCategories().Where(w => w.CategoryName == "UnityTestCatModified_CategoryTest").FirstOrDefault();

            Assert.IsNotNull(category);

            var result = _catProvider.DeleteCategory(category);

            Assert.AreEqual(result, 1);

            var searchCountMod = _catProvider.GetCategories().Where(w => w.CategoryName == "UnityTestCatModified_CategoryTest").ToList().Count;

            Assert.IsTrue(searchCountMod == 0);
        }
Example #4
0
        //[Test]
        //[Category("CollectionDataTest")]
        public void TestMethod_DeleteCollection()
        {
            var searchCol = _colProvider.GetCollections().Where(w => w.WorkoutTitle == "UnitTest_CollectionTest").FirstOrDefault();

            Assert.IsNotNull(searchCol);

            var response = _colProvider.DeleteCollection(searchCol);

            Assert.AreEqual(response, 1);

            var category = _catProvider.GetCategories().Where(w => w.CategoryName == "UnityTestCat_CollectionTest").FirstOrDefault();

            Assert.IsNotNull(category);

            var result = _catProvider.DeleteCategory(category);

            Assert.AreEqual(result, 1);
        }
Example #5
0
        public async Task <StandardOutput <bool> > DeleteCategory(int id)
        {
            var responseMessage = await _categoryProvider.DeleteCategory(id);

            if (responseMessage.StateCode != Define.StateCode.OK)
            {
                return new StandardOutput <bool>
                       {
                           Entity  = false,
                           Message = $"Delete category failed. Check if category id: {id} Not Found."
                       }
            }
            ;
            return(new StandardOutput <bool>
            {
                Entity = true,
                Message = "Delete category succeed."
            });
        }
    }
Example #6
0
        public ActionResult DeleteCategory(int categoryId)
        {
            _categoryProvider.DeleteCategory(categoryId);

            return(RedirectToAction("ShowCategories"));
        }