public void addContactInfoTest() { ContactInfo testCI = new ContactInfo() { Information = "TestInformation", Title = "TestTitle" }; int initialNumContactInfos = db.retrieveAllContactInfos().Count; db.addContactInfo(testCI, 5); int finalNumContactInfos = db.retrieveAllContactInfos().Count; Assert.AreEqual(initialNumContactInfos + 1, finalNumContactInfos, "ContactInfo Add Failed"); }
public void addContactInfoTest() { db.addUser(testUser); int numUsers = db.retrieveAllUsers().Count; ContactInfo testCI = new ContactInfo() { Information = "TestInformation", Title = "TestTitle", UserId = numUsers }; int preAddNumContactInfos = db.retrieveAllContactInfos().Count; db.addContactInfo(testCI, numUsers); int postAddNumContactInfos = db.retrieveAllContactInfos().Count; Assert.AreEqual(preAddNumContactInfos + 1, postAddNumContactInfos, "ContactInfo 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 updateContactInfoTest() { db.addUser(testUser); int numUsers = db.retrieveAllUsers().Count; ContactInfo testCI = new ContactInfo() { Information = "TestInformation", Title = "TestTitle", UserId = numUsers }; int preAddNumContactInfos = db.retrieveAllContactInfos().Count; db.addContactInfo(testCI, numUsers); int postAddNumContactInfos = db.retrieveAllContactInfos().Count; Assert.AreEqual(preAddNumContactInfos + 1, postAddNumContactInfos, "ContactInfo Add Failed"); ContactInfo testEdit = new ContactInfo() { Information = "EditedInformation", Title = "EditedTitle", UserId = numUsers, Id = postAddNumContactInfos }; db.updateContactInfo(testEdit); ContactInfo updatedCI = db.retrieveContactInfo(postAddNumContactInfos); Assert.AreEqual(testEdit.Information, updatedCI.Information, "ContactInfo Update Failed (Information)"); Assert.AreEqual(testEdit.Title, updatedCI.Title, "ContactInfo Update Failed (Title)"); }