static void Main(string[] args) { var selection = String.Empty; while (selection != "q") { Console.WriteLine("1 - Permutations"); Console.WriteLine("2 - String Replace"); Console.WriteLine("3 - Replace Repeats"); Console.WriteLine("Q - Quit"); selection = Console.ReadLine().ToLower(); switch (selection) { case "1": Console.WriteLine(IsPermutation("a", "a")); //True Console.WriteLine(IsPermutation("asd", "dsa"));//True Console.WriteLine(IsPermutation("abb", "bbb"));//False Console.WriteLine(IsPermutation("abc", "abcd"));//False break; case "2": Console.WriteLine(ReplaceString("My John Smith")); break; case "3": ReplaceRepeats rr = new ReplaceRepeats("abc"); Console.WriteLine(rr.Execute()); rr.StringToUpdate = "aabbccc"; Console.WriteLine(rr.Execute()); rr.StringToUpdate = "aabbbbccccaaaa"; Console.WriteLine(rr.Execute()); break; default: break; } } Environment.Exit(0); }
public void RRTest3RepeatingCharacters() { ReplaceRepeats rr = new ReplaceRepeats("aaa"); Assert.AreEqual("a3", rr.Execute()); }
public void RRTest3Characters() { ReplaceRepeats rr = new ReplaceRepeats("abc"); Assert.AreEqual("abc", rr.Execute()); }