public void PublishPageShouldFail(string username, string password, string title, string content) { blog = new Blog(_authenticator = new MockAuthenticator()); blog.LoginUser(new User(username) { Password = password }); var userIsLoggedIn = blog.UserIsLoggedIn; //Check to see that user is really logged in Assert.That(userIsLoggedIn == true, "User should be logged in"); //Instead of page, send in null Assert.Throws <IncorrectPageException>(() => blog.PublishPage(null), "The publish should not have been succesful"); blog.LogoutUser(new User(username) { Password = password }); userIsLoggedIn = blog.UserIsLoggedIn; //Check to see that user is really logged out Assert.That(userIsLoggedIn == false, "User should be logged in"); //Publish page when user is not logged in Assert.That(blog.PublishPage(new Page { Title = title, Content = content }) == false, "The user is not logged in, publish should fail"); }
public void PageBeeingPublishedShouldNotSucceedIfPageObjectNotValid(string username, string password, string title, string content) { blog = new Blog(_authenticator = new MockAuthenticator()); //Loggar in anv. först och kollar att det lyckades blog.LoginUser(new User(username) { Password = password }); var userIsLoggedIn = blog.UserIsLoggedIn; Assert.IsTrue(userIsLoggedIn, "User login should be successful"); //Skapa Page-objektet misslyckas när null skickas med Assert.Throws <PageIsNotCorrectObjektException>(() => blog.PublishPage(null), "The publish should not have been succesful"); }
public void PageBeeingPublishedShouldNotSucceedNoUserIsLoggedIn(string title, string content) { blog = new Blog(_authenticator = new MockAuthenticator()); var userIsLoggedIn = blog.UserIsLoggedIn; Assert.IsFalse(userIsLoggedIn, "User login should not be successful"); if (userIsLoggedIn) { //Skapa Page-objektet och kollar att det är ok och publicerat Assert.That(blog.PublishPage(new Page() { Title = title, Content = content }) == true, "The new page should be successfully published"); } }
public void PublishPageShouldSucceed(string username, string password, string title, string content) { blog = new Blog(_authenticator = new MockAuthenticator()); blog.LoginUser(new User(username) { Password = password }); var userIsLoggedIn = blog.UserIsLoggedIn; //Check to see that user is really logged in Assert.That(userIsLoggedIn == true, "User should be logged in"); Assert.That(blog.PublishPage(new Page() { Title = title, Content = content }) == true, "The publish should have been succesful"); }
public void PageBeeingPublishedShouldSucceed(string username, string password, string title, string content) { blog = new Blog(_authenticator = new MockAuthenticator()); //Loggar in anv. först och kollar att det lyckades blog.LoginUser(new User(username) { Password = password }); var userIsLoggedIn = blog.UserIsLoggedIn; Assert.IsTrue(userIsLoggedIn, "User login should be successful"); //Skapa Page-objektet och kollar att det är ok och publicerat Assert.That(blog.PublishPage(new Page() { Title = title, Content = content }) == true, "The new page should be successfully published"); }