public void addLinkTest()
        {
            Link testL = new Link()
            {
                DisplayText = "TestDisplayText", URL = "www.Google.com"
            };
            int initialNumLinks = db.retrieveAllLinks().Count;
            db.addLink(testL, 5);
            int finalNumLinks = db.retrieveAllLinks().Count;

            Assert.AreEqual(initialNumLinks + 1, finalNumLinks, "Link Add Failed");
        }
Пример #2
0
        public void updateLinkTest()
        {
            db.addUser(testUser);

            int numUsers = db.retrieveAllUsers().Count;

            int initialNumLinks = db.retrieveAllLinks().Count;
            db.addLink(testLink, numUsers);
            int finalNumLinks = db.retrieveAllLinks().Count;

            Assert.AreEqual(initialNumLinks + 1, finalNumLinks, "Link Add Failed");

            Link testEdit = new Link()
            {
               DisplayText = "EditedDisplayText",
               URL = "www.edited.com",
               Id = finalNumLinks
            };

            db.updateLink(testEdit, numUsers);

            Link updatedLink = db.retrieveLink(finalNumLinks);
            Assert.AreEqual(testEdit.DisplayText, updatedLink.DisplayText, "Link Update Failed (DisplayText)");
            Assert.AreEqual(testEdit.URL, updatedLink.URL, "Link Update Failed (URL)");
        }
Пример #3
0
        public void addLinkTest()
        {
            db.addUser(testUser);

            int numUsers = db.retrieveAllUsers().Count;
            Link testL = new Link()
            {
                DisplayText = "TestDisplayText", URL = "www.Google.com"
            };
            int initialNumLinks = db.retrieveAllLinks().Count;
            db.addLink(testL, numUsers);
            int finalNumLinks = db.retrieveAllLinks().Count;

            Assert.AreEqual(initialNumLinks + 1, finalNumLinks, "Link Add Failed");

            User toDelete = db.retrieveUser(numUsers);
            db.deleteUser(toDelete);

            int postDeleteUsers = db.retrieveAllUsers().Count;
            Assert.AreEqual(numUsers - 1, postDeleteUsers, "User Delete Failed");
        }