//A test for is_palindrome function void is_palindrome_true_test() { PalindromeClass cls_palindrome = new PalindromeClass(); String s = "anna"; bool actual = cls_palindrome.is_palindrome(s); const bool expected = true; Assert.AreEqual(expected, actual); }
public static void Main(string[] args) { string key = ""; PalindromeClass cls_palindrome = new PalindromeClass(); while (key != "n") { Console.WriteLine("\n*** Enter a String ***\n"); Console.WriteLine("Instructions:"); Console.WriteLine("There should be no whitespace in the string"); Console.WriteLine("All characters in the string must be lower case"); Console.WriteLine("The string will only contain alpha characters a-z \n"); String s = Console.ReadLine(); while (!cls_palindrome.is_invalidString(s)) { Console.WriteLine("Please enter a valid string \n"); s = Console.ReadLine(); } if (cls_palindrome.is_palindrome(s)) { Console.WriteLine("String is a Palindrome \n"); } if (cls_palindrome.is_anagram(s)) { Console.WriteLine("String is an Anagram of a Palindrome \n"); } if (!cls_palindrome.is_palindrome(s) && !cls_palindrome.is_anagram(s)) { Console.WriteLine("String is neither a Palindrome nor an Anagram of a Palindrome \n"); } Console.WriteLine("Do you want to continue? Press 'y' for YES and 'n' for NO"); key = Console.ReadKey().KeyChar.ToString(); } }
public bool is_Palindrom_and_AnagramTest(String s) { PalindromeClass cls_palindrome = new PalindromeClass(); return(cls_palindrome.is_palindrome(s) && cls_palindrome.is_anagram(s)); }
public bool is_PalindromeTest(String s) { PalindromeClass cls_palindrome = new PalindromeClass(); return(cls_palindrome.is_palindrome(s)); }