Пример #1
0
        static void Main(string[] args)
        {
            Console.WriteLine("Enter two strings");
            string str1 = Console.ReadLine();
            string str2 = Console.ReadLine();

            StringTools stringtools = new StringTools();

            Console.WriteLine();
            Console.WriteLine("This is result:" + " " + stringtools.GetLongestCommonSequence(str1, str2));
        }
Пример #2
0
        public void GetLongestCommonSequenceTest(string str1, string str2, string[] expected)
        {
            var constrain = Is.EqualTo(expected.Length > 0 ? expected[0] : "");

            for (var i = 1; i < expected.Length; i++)
            {
                constrain = constrain.Or.EqualTo(expected[i]);
            }

            Assert.That(tools.GetLongestCommonSequence(str1, str2), constrain);
        }