Ejemplo n.º 1
0
        public void ReplaceString()
        {
            ReplaceSpace replaceSpace = new ReplaceSpace();
            var          result       = replaceSpace.Replace("Mr John Smith");

            Assert.AreEqual("Mr%20John%20Smith", result);
        }
Ejemplo n.º 2
0
        static void Main(string[] args)
        {
            bool isLinkedListTest  = false;
            bool isStringArrayTest = true;

            if (isLinkedListTest)
            {
                SinglyLinkedList sList = new SinglyLinkedList();
                DoublyLinkList   dList = new DoublyLinkList();
                CircularLinkList cList = new CircularLinkList();
                Random           rand  = new Random();
                for (int i = 0; i < 10; i++)
                {
                    var nodeVal = rand.Next(10, 20);
                    sList.AddNewNode(nodeVal.ToString());
                    dList.AddNewNode(nodeVal.ToString());
                    cList.AddNewNode(nodeVal.ToString());
                }
                sList.PrintAllNode();
                sList.ReverseNode();
                sList.RemoveDuplicateWithBuffer();
                // sList.RemoveDuplicateWithoutBuffer();
            }
            if (isStringArrayTest)
            {
                ShiftCharacterKpositions shiftCharacter = new ShiftCharacterKpositions();

                shiftCharacter.SiftByK("abnish", 2);

                StringHasUniqueChar stringHasUniqueChar = new StringHasUniqueChar();
                stringHasUniqueChar.StringHasUniqueCharacter("aba");

                CheckPermutation checkPermutation = new CheckPermutation();
                checkPermutation.CheckStringPermutation("abnish", "shabnI");
                ReplaceSpace replaceSpace = new ReplaceSpace();
                replaceSpace.ReplaceSpaceWithPercent20("abnish kumar choudhary   ");

                OneAwayString oneAwayString = new OneAwayString();
                oneAwayString.CheckOneAwayString("abnish", "abnis");
                oneAwayString.CheckOneAwayString("abnish", "abnish");
                oneAwayString.CheckOneAwayString("abnish", "sanjeet");
            }
            Console.ReadKey();
        }
        public void Replace_PassedStringWith2InnerSpaces_ReturnsStringWithReplacements()
        {
            string correct = "test%20it%20now";;

            Assert.AreEqual(correct, ReplaceSpace.Replace("test it now"));
        }
        public void Replace_PassedStringWithSpaceAtEnd_ReturnsOriginalString()
        {
            string correct = "test";

            Assert.AreEqual(correct, ReplaceSpace.Replace("test "));
        }
        public void Replace_PassedEmptyString_ReturnsEmptyString()
        {
            string correct = "";;

            Assert.AreEqual(correct, ReplaceSpace.Replace(""));
        }