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); }
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); }
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); }
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); } }
public void LoginValidUsernameandInvalidPassword() { SteveDelezioSEAssignment2Sit1.MyService.ServiceManager ms = new SteveDelezioSEAssignment2Sit1.MyService.ServiceManager(); bool login = ms.Login("Leli", "x"); Assert.AreEqual(false, login); }
public void LoginLongUsernameandEmptyPassword() { SteveDelezioSEAssignment2Sit1.MyService.ServiceManager ms = new SteveDelezioSEAssignment2Sit1.MyService.ServiceManager(); bool login = ms.Login("xRGJ9FmsKg2aMG1pADHe1fq0meKponxhHOtURjaeDVZIBHeZC", String.Empty); Assert.AreEqual(false, login); }
public void LoginEmptyUsername() { SteveDelezioSEAssignment2Sit1.MyService.ServiceManager ms = new SteveDelezioSEAssignment2Sit1.MyService.ServiceManager(); bool login = ms.Login(String.Empty, "abc123"); Assert.AreEqual(false, login); }
public void Login() { SteveDelezioSEAssignment2Sit1.MyService.ServiceManager ms = new SteveDelezioSEAssignment2Sit1.MyService.ServiceManager(); bool login=ms.Login("Leli", "abc123"); Assert.AreEqual(true,login); }
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); } }
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); }
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); } }
public void ReadArticle() { SteveDelezioSEAssignment2Sit1.MyService.ServiceManager ms = new SteveDelezioSEAssignment2Sit1.MyService.ServiceManager(); DataContext db = new DataContext(); // ArticlesController r = new ArticlesController(); // r.Details(5); }