public void addPortfolioTest() { db.addUser(testUser); int numUsers = db.retrieveAllUsers().Count; Portfolio testP = new Portfolio() { Title = "TestTitle", Description = "TestDescription", IsMainPortfolio = true, Projects = new List<Project>(), Visibility = 1 }; int initialNumPortfolios = db.retrieveAllPortfolios().Count; db.addPortfolio(testP, numUsers); int finalNumPortfolios = db.retrieveAllPortfolios().Count; Assert.AreEqual(initialNumPortfolios + 1, finalNumPortfolios, "Portfolio Add Failed"); User toDelete = db.retrieveUser(numUsers); db.deleteUser(toDelete); int postDeleteUsers = db.retrieveAllUsers().Count; Assert.AreEqual(numUsers - 1, postDeleteUsers, "User Delete Failed"); }
public void updatePortfolioTest() { db.addUser(testUser); int numUsers = db.retrieveAllUsers().Count; int initialNumPortfolios = db.retrieveAllPortfolios().Count; db.addPortfolio(testPortfolio, numUsers); int finalNumPortfolios = db.retrieveAllPortfolios().Count; Assert.AreEqual(initialNumPortfolios + 1, finalNumPortfolios, "Portfolio Add Failed"); Portfolio testEdit = new Portfolio() { Title = "EditedTitle", Description = "EditedDescription", IsMainPortfolio = false, Visibility = 2, Id = finalNumPortfolios }; db.updatePortfolio(testEdit, numUsers); Portfolio updatedPortfolio = db.retrievePortfolio(finalNumPortfolios); Assert.AreEqual(testEdit.Title, updatedPortfolio.Title, "Portfolio Update Failed (Title)"); Assert.AreEqual(testEdit.Description, updatedPortfolio.Description, "Portfolio Update Failed (Description)"); Assert.AreEqual(testEdit.IsMainPortfolio, updatedPortfolio.IsMainPortfolio, "Portfolio Update Failed (IsMainPortfolio)"); Assert.AreEqual(testEdit.Visibility, updatedPortfolio.Visibility, "Portfolio Update Failed (Visibility)"); }
public void addPortfolioTest() { Portfolio testP = new Portfolio() { Title = "TestTitle", Description = "TestDescription", IsMainPortfolio = true, Projects = new List<Project>(), Visibility = 1 }; int initialNumPortfolios = db.retrieveAllPortfolios().Count; db.addPortfolio(testP, 5); int finalNumPortfolios = db.retrieveAllPortfolios().Count; Assert.AreEqual(initialNumPortfolios + 1, finalNumPortfolios, "Portfolio Add Failed"); }