Esempio n. 1
0
        public void ConvertSentence_FindAndReplace_String()
        {
            string source      = "she sells sea shells on the seashore";
            string expected    = "she sells OCEAN shells on the OCEANshore"; //she sells sea shells on the seashore
            FindR  newObject   = new FindR();
            string replacement = newObject.ConvertSentence(source, "sea", "OCEAN");

            Assert.AreEqual(expected, replacement);
        }
Esempio n. 2
0
        public static void Main()
        {
            Console.WriteLine("Enter a sentence:");
            string source = Console.ReadLine();

            Console.WriteLine("Enter FROM string:");
            string from = Console.ReadLine();

            Console.WriteLine("Enter TO string:");
            string to = Console.ReadLine();

            FindR userSentence = new FindR();

            string replacement = userSentence.ConvertSentence(source, from, to);

            Console.WriteLine($"The source string is <{source}>");
            Console.WriteLine($"The updated string is <{replacement}>");
        }