Ejemplo n.º 1
0
        public async void TagsController_Delete()
        {
            var ctrlr  = new TagsController(_dbContext);
            var result = await ctrlr.DeleteConfirmed(2);

            var resultView = Assert.IsType <RedirectToActionResult>(result);

            Assert.Equal(0, _dbContext.Tag.Count(d => d.TagId == 2));
            Assert.Equal(1, _dbContext.ArticleTag.Count());
            Assert.Equal(2, _dbContext.MediaKitFileTag.Count());
        }
Ejemplo n.º 2
0
        private async Task DeleteAllTagsAsync()
        {
            var c     = new TagsController(_context);
            var index = await c.Index();

            var list = (Microsoft.AspNetCore.Mvc.ViewResult)index;
            var IndexTagViewModel = (IndexTagViewModel)list.Model;

            foreach (var tag in IndexTagViewModel.TagModels)
            {
                var result = await c.DeleteConfirmed(tag.TagID, tag.ActivityID);
            }
        }