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 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 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); }