public void RemoveNormalUniqueKeyword() { String expectedkeyword = "Testing"; Paper existingpaper = new Paper(); Author a = new Author(); existingpaper.removeKeyword(expectedkeyword); List<String> keywords = existingpaper.listKeywords(); bool removed = keywords.Contains(expectedkeyword); Assert.IsFalse(removed); }
public void FindNoKeywordAuthor() { //Create a new author with a keyword String expectedAuthor = "Nürnberg"; Author a = new Author(expectedAuthor); //Check if the author names match List<String> actualAuthorList = a.getAuthors(); String actualAuthor = actualAuthorList.Find(s => s == expectedAuthor); Assert.AreEqual(actualAuthor, expectedAuthor); //Returns an error of no keywords List<String> nonexistingKeywords = a.getAuthorKeywords(expectedAuthor); Assert.AreEqual(nonexistingKeywords, null); }
public void AddNormalUniqueKeyword() { String expectedkeyword = "Testing"; Paper existingpaper = new Paper(); Author a = new Author(); existingpaper.addKeyword(expectedkeyword); List<String> keywords = existingpaper.listKeywords(); List<String> authorkeywords = a.listKeywords(); String actual = keywords.Find(s => s == expectedkeyword); Assert.AreEqual(actual, expectedkeyword); actual = authorkeywords.Find(s => s == expectedkeyword); Assert.AreEqual(actual, expectedkeyword); }
public void FindNonExistingAuthor() { //Create a new author with a keyword String expectedAuthor = "John Smith"; Author a = new Author(expectedAuthor); String expectedKeyword = "Fusion"; a.addKeyword(expectedKeyword); //Check if the author names match List<String> actualAuthorList = a.getAuthors(); String actualAuthor = actualAuthorList.Find(s => s == expectedAuthor); Assert.AreEqual(actualAuthor, expectedAuthor); //Raises an error if the author does not exist String nonExistingAuthor = "Mei Wang"; String invalidAuthor = actualAuthorList.Find(s => s == nonExistingAuthor); Assert.AreEqual(invalidAuthor, null); }
public void FindAllNumericalAuthor() { //Create a new author with a keyword String expectedAuthor ="4526123456"; Author a = new Author(expectedAuthor); String expectedKeyword = "Fusion"; a.addKeyword(expectedKeyword); //Check if the author names match List<String> actualAuthorList = a.getAuthors(); String actualAuthor = actualAuthorList.Find(s => s == expectedAuthor); Assert.AreEqual(actualAuthor, expectedAuthor); //Check if the keywords from the author match to the inputed keyword List<String> actualKeywords = a.getAuthorKeywords(expectedAuthor); String actual = actualKeywords.Find(s => s == expectedKeyword); Assert.AreEqual(actualKeywords, expectedKeyword); }
public void UnicodeAuthor() { //The input author is unicode symbols String unicodeAuthor = "╙φ¼╒≥│Θ╛╞"; Author a = new Author(unicodeAuthor); List<String> keywords = a.listKeywords(unicodeAuthor); }
public void emptyAuthor() { //The input author is a bunch of text symbols String emptyInputAuthor = "\t \n \t"; Author a = new Author(emptyInputAuthor); }
public void TabAuthor() { //The input author is full of tabs String tabInputAuthor = " "; Author a = new Author(tabInputAuthor); }
public void SpaceAuthor() { //The input Author is full if spaces String spaceInputAuthor = " "; Author a = new Author(spaceInputAuthor); }
public void emptyAuthor() { //The input author is a empty string String emptyInputAuthor = ""; Author a = new Author(emptyInputAuthor); }
public void NullAuthor() { //The input author is null String nullInputAuthor = null; Author a = new Author(nullInputAuthor); }
public void FindPartialUnicodeAuthor() { //Create a new author with a keyword String expectedAuthor ="Nürnberg"; Author a = new Author(expectedAuthor); String expectedKeyword = "Mathematics"; a.addKeyword(expectedKeyword); //Check if the author names match List<String> actualAuthorList = a.getAuthors(); String actualAuthor = actualAuthorList.Find(s => s == expectedAuthor); Assert.AreEqual(actualAuthor, expectedAuthor); //Check if the keywords from the author match to the inputed keyword List<String> actualKeywords = a.getAuthorKeywords(expectedAuthor); String actual = actualKeywords.Find(s => s == expectedKeyword); Assert.AreEqual(actualKeywords, expectedKeyword); }