public void Activity_Delete()
        {
            int totalActivitiesBefore = activities.Count;
            var idToDelete            = activities.FirstOrDefault().ActivityID;

            controller.DeleteConfirmed(activities.FirstOrDefault().ActivityID);

            //Assert
            Assert.IsTrue(totalActivitiesBefore > activities.Count);
            Assert.IsFalse(activities.Any(a => a.ActivityID == idToDelete));
        }
Exemplo n.º 2
0
        private async Task DeleteAllActivitiesAsync()
        {
            var c     = new ActivitiesController(_context);
            var index = await c.Index();

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

            foreach (var activity in IndexActivityViewModel.ActivityModels)
            {
                var result = await c.DeleteConfirmed(activity.ActivityID);
            }
        }