public void OneItem() { var input = new[] { "flower" }; var expected = "flower"; var actual = _kata.FindLongestCommonPrefix(input); Assert.AreEqual(expected, actual); }
public static void Main(string[] args) { //var result = ReverseInteger.Reverse(123); //var result = Palindrome.IsPalindrome(123); var result = LongestCommonPrefix.FindLongestCommonPrefix(new string[] { "dog", "racecar", "car" }); Console.WriteLine(result); Console.ReadLine(); }
public void Test_FindLongestCommonPrefix() { var testStrings = new Dictionary <string, string[]> { { "fl", new string[] { "flower", "flow", "flight" } }, { "", new string[] { "dog", "racecar", "car" } }, { "a", new string[] { "apple", "air", "ask" } }, { "go", new string[] { "good", "god", "go" } }, { "some", new string[] { "sometime", "someone", "somebody" } }, { "at", new string[] { "at", "at", "at" } }, }; foreach (var kvp in testStrings) { var input = kvp.Value; var actual = _objUnderTest.FindLongestCommonPrefix(input); var expected = kvp.Key; Assert.Equal(expected, actual); } }