public void updateUserTest() { User testAdd = new User() { FirstName = "TestUser", LastName = "McTesterson", Email = "*****@*****.**", ContactInfoes = new List<ContactInfo>(), Educations = new List<Education>(), Links = new List<Link>(), Contributions = new List<Contribution>(), Portfolios = new List<Portfolio>(), Notifications = new List<Notification>(), ProjectPermissions = new List<ProjectPermission>(), QuickReferences = new List<QuickReference>() }; int preAddUsers = db.retrieveAllUsers().Count; db.addUser(testAdd); int postAddUsers = db.retrieveAllUsers().Count; Assert.AreEqual(preAddUsers + 1, postAddUsers, "User Add Failed"); User testEdit = new User() { FirstName = "Edited", LastName = "McEdited", Email = "*****@*****.**", Id = postAddUsers }; db.updateUser(testEdit); User updatedUser = db.retrieveUser(postAddUsers); Assert.AreEqual(testEdit.FirstName, updatedUser.FirstName, "User Update Failed (FirstName)"); Assert.AreEqual(testEdit.LastName, updatedUser.LastName, "User Update Failed (LastName)"); Assert.AreEqual(testEdit.Email, updatedUser.Email, "User Update Failed (Email)"); }
public void addUserTest() { User testAdd = new User() { FirstName = "TestUser", LastName = "McTesterson", Email = "*****@*****.**", ContactInfoes = new List<ContactInfo>(), Educations = new List<Education>(), Links = new List<Link>(), Media = new List<Medium>(), Contributions = new List<Contribution>(), Portfolios = new List<Portfolio>(), Notifications = new List<Notification>(), ProjectPermissions = new List<ProjectPermission>(), QuickReferences = new List<QuickReference>() }; int initialNumUsers = db.retrieveAllUsers().Count; db.addUser(testAdd); int finalNumUsers = db.retrieveAllUsers().Count; Assert.AreEqual(initialNumUsers+1, finalNumUsers, "User Add Failed"); //ContactInfo testCI = new ContactInfo() { Information = "info", Title = "Sir" }; //db.addContactInfo(testCI, 5); //Portfolio testM = new Portfolio() {Description = "description!", Title = "Test Contribution", IsMainPortfolio = true, Visibility = 1, Projects = new List<Project>() }; //db.addPortfolio(testM, 5); //User toDelete = db.retrieveUser(5); //db.deleteUser(toDelete); }