コード例 #1
0
        public void GetAllArticles()
        {
            //Arrange
            IArticleLogic  logic       = LogicFactory.CreateArticleMemoryLogic();
            List <Article> AllArticles = logic.GetAllArticles();

            //Act
            int expected = 2;
            int actual   = AllArticles.Count();

            //Assert
            Assert.AreEqual(expected, actual);
        }
コード例 #2
0
 public ActionResult Index()
 {
     try
     {
         articleViewModel.Articles = logic.GetAllArticles();
         return(View(articleViewModel));
     }
     catch (SqlException sqlException)
     {
         return(View("Error", sqlException));
     }
     catch (InvalidCastException invalidCastException)
     {
         return(View("Error", invalidCastException));
     }
 }