コード例 #1
0
 public void CreateArticleTestWithInvalidDateTime()
 {
     SteveDelezioSEAssignment2Sit1.MyService.ServiceManager ms = new SteveDelezioSEAssignment2Sit1.MyService.ServiceManager();
     DataContext db = new DataContext();
     int intialCount = db.tbl_Articles.Count();
     ms.CreateArticle("TestingTitle", "TestingContent", "TestinComment", DateTime.Parse("23/01/2015"), 2, 3, 5, 1);
     int FinalCount = db.tbl_Articles.Count();
     Assert.AreEqual(intialCount, FinalCount);
 }
コード例 #2
0
 public void CreateArticleTestWithEmptyTitle()
 {
     SteveDelezioSEAssignment2Sit1.MyService.ServiceManager ms = new SteveDelezioSEAssignment2Sit1.MyService.ServiceManager();
     DataContext db = new DataContext();
     int intialCount = db.tbl_Articles.Count();
     ms.CreateArticle(String.Empty, "TestingContent", "TestinComment", DateTime.Now, 2, 3, 5, 1);
     int FinalCount = db.tbl_Articles.Count();
     Assert.AreEqual(intialCount, FinalCount);
 }
コード例 #3
0
        public void DeleteArticle()
        {
            SteveDelezioSEAssignment2Sit1.MyService.ServiceManager ms = new SteveDelezioSEAssignment2Sit1.MyService.ServiceManager();
            DataContext db = new DataContext();
            int initialCount = db.tbl_Articles.Count();

            ms.DeleteArticle(12);
            int FinalCount = db.tbl_Articles.Count();
            Assert.AreEqual(initialCount - 1, FinalCount);
        }
コード例 #4
0
        public void DeleteArticleNonExistingArticle()
        {
            DataContext db = new DataContext();
            int initialCount = db.tbl_Articles.Count();
            SteveDelezioSEAssignment2Sit1.MyService.ServiceManager ms =
                new SteveDelezioSEAssignment2Sit1.MyService.ServiceManager();
            try
            {
                ms.DeleteArticle(950);
            }
            finally
            {

                int FinalCount = db.tbl_Articles.Count();

                Assert.AreEqual(initialCount, FinalCount);
            }
        }
コード例 #5
0
 public void LoginValidUsernameandInvalidPassword()
 {
     SteveDelezioSEAssignment2Sit1.MyService.ServiceManager ms =
          new SteveDelezioSEAssignment2Sit1.MyService.ServiceManager();
     bool login = ms.Login("Leli", "x");
     Assert.AreEqual(false, login);
 }
コード例 #6
0
 public void LoginLongUsernameandEmptyPassword()
 {
     SteveDelezioSEAssignment2Sit1.MyService.ServiceManager ms =
          new SteveDelezioSEAssignment2Sit1.MyService.ServiceManager();
     bool login = ms.Login("xRGJ9FmsKg2aMG1pADHe1fq0meKponxhHOtURjaeDVZIBHeZC", String.Empty);
     Assert.AreEqual(false, login);
 }
コード例 #7
0
 public void LoginEmptyUsername()
 {
     SteveDelezioSEAssignment2Sit1.MyService.ServiceManager ms =
          new SteveDelezioSEAssignment2Sit1.MyService.ServiceManager();
     bool login = ms.Login(String.Empty, "abc123");
     Assert.AreEqual(false, login);
 }
コード例 #8
0
 public void Login()
 {
     SteveDelezioSEAssignment2Sit1.MyService.ServiceManager ms =
          new SteveDelezioSEAssignment2Sit1.MyService.ServiceManager();
     bool login=ms.Login("Leli", "abc123");
     Assert.AreEqual(true,login);
 }
コード例 #9
0
        public void DeleteArticleWithInvalidId()
        {
            int initialCount = 0;
            int FinalCount = 0;
            DataContext db = new DataContext();
            try
            {
                SteveDelezioSEAssignment2Sit1.MyService.ServiceManager ms =
                    new SteveDelezioSEAssignment2Sit1.MyService.ServiceManager();

                 initialCount = db.tbl_Articles.Count();

                ms.DeleteArticle(-12);

            }
            finally
            {
                FinalCount = db.tbl_Articles.Count();
                Assert.AreEqual(initialCount, FinalCount);
            }
        }
コード例 #10
0
        public void UpdateArticleEmptyTitle()
        {
            SteveDelezioSEAssignment2Sit1.MyService.ServiceManager ms = new SteveDelezioSEAssignment2Sit1.MyService.ServiceManager();
            DataContext db = new DataContext();
            tbl_Articles unupdated = db.tbl_Articles.SingleOrDefault(x => x.ArticleId == 12);
            string unupdatedTitle = unupdated.ArticleTitle;
            string unupdatedContent = unupdated.ArticleContent;
            string unupdatedComments = unupdated.ArticleComments;
            ms.UpdateArticle(String.Empty, "UpdatedContent", "UpdatedComment", DateTime.Now, unupdated.UserId, unupdated.ArticleMediaManagerId, unupdated.ArticleStatusId, unupdated.ArticleStateId, unupdated.ArticleId);
            db.Entry(unupdated).Reload();

            tbl_Articles updated = db.tbl_Articles.SingleOrDefault(x => x.ArticleId == 12);
            Assert.AreEqual(unupdated.ArticleId, updated.ArticleId);
            Assert.AreEqual(unupdatedTitle, updated.ArticleTitle);
            Assert.AreEqual(unupdatedContent, updated.ArticleContent);
            Assert.AreEqual(unupdatedComments, updated.ArticleComments);
        }
コード例 #11
0
 public void ReadArticleWithWrongId()
 {
     SteveDelezioSEAssignment2Sit1.MyService.ServiceManager ms = new SteveDelezioSEAssignment2Sit1.MyService.ServiceManager();
     DataContext db = new DataContext();
     ArticlesController ac = new ArticlesController();
     tbl_Articles testarticle = new tbl_Articles();
     try
     {
         testarticle = ac.GetArticleById(-11);
     }
     finally
     {
         Assert.AreEqual(String.Empty, testarticle.ArticleContent);
     }
 }
コード例 #12
0
 public void ReadArticle()
 {
     SteveDelezioSEAssignment2Sit1.MyService.ServiceManager ms = new SteveDelezioSEAssignment2Sit1.MyService.ServiceManager();
     DataContext db = new DataContext();
     // ArticlesController r = new ArticlesController();
     //  r.Details(5);
 }