Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 2
0
        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);
        }
Ejemplo n.º 3
0
        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);
        }