Beispiel #1
0
        public void Test_ArticleController_ArticleList_WrongUSer()
        {
            // Arrange
            utils.CleanTables();
            Tuple <string, string> userIds = utils.CreateUsers();

            utils.CreateSingleArticle(userIds.Item2);
            utils.CreateSingleArticle(userIds.Item2);
            string            wrong_user = "******";
            ArticleController controller = ControllerSetup(wrong_user, RoleType.Employee.ToString());

            // Act
            IEnumerable <ArticleViewModel> articles = controller.ArticleList().ViewData.Model as IEnumerable <ArticleViewModel>;

            // Assert
            Assert.IsNull(articles);
        }
Beispiel #2
0
        public void Test_ArticleController_ArticleList()
        {
            // Arrange
            utils.CleanTables();
            Tuple <string, string> userIds = utils.CreateUsers();

            utils.CreateSingleArticle(userIds.Item2);
            utils.CreateSingleArticle(userIds.Item2);
            ArticleController controller = ControllerSetup(userIds.Item1, RoleType.Employee.ToString());

            // Act
            IEnumerable <ArticleViewModel> articles = controller.ArticleList().ViewData.Model as IEnumerable <ArticleViewModel>;

            // Assert
            Assert.IsNotNull(articles);
            Assert.AreEqual <int>(2, articles.Count());
        }