コード例 #1
0
ファイル: AddKeywordTests.cs プロジェクト: ehrs-seng/Map
        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);
        }
コード例 #2
0
        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);
        }
コード例 #3
0
ファイル: AddKeywordTests.cs プロジェクト: ehrs-seng/Map
        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);
        }
コード例 #4
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);
        }
コード例 #5
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);
        }
コード例 #6
0
        public void UnicodeAuthor()
        {
            //The input author is unicode symbols
            String unicodeAuthor = "╙φ¼╒≥│Θ╛╞";
            Author a = new Author(unicodeAuthor);

            List<String> keywords = a.listKeywords(unicodeAuthor);
        }
コード例 #7
0
 public void emptyAuthor()
 {
     //The input author is a bunch of text symbols
     String emptyInputAuthor = "\t \n \t";
     Author a = new Author(emptyInputAuthor);
 }
コード例 #8
0
 public void TabAuthor()
 {
     //The input author is full of tabs
     String tabInputAuthor = "                 ";
     Author a = new Author(tabInputAuthor);
 }
コード例 #9
0
 public void SpaceAuthor()
 {
     //The input Author is full if spaces
     String spaceInputAuthor = "               ";
     Author a = new Author(spaceInputAuthor);
 }
コード例 #10
0
 public void emptyAuthor()
 {
     //The input author is a empty string
     String emptyInputAuthor = "";
     Author a = new Author(emptyInputAuthor);
 }
コード例 #11
0
 public void NullAuthor()
 {
     //The input author is null
         String nullInputAuthor = null;
         Author a = new Author(nullInputAuthor);
 }
コード例 #12
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);
        }