private static void ArrangeActAssert(string given, string expected)
        {
            var    wordReverser = new WordReverser();
            string result       = wordReverser.Reverse(given);

            Assert.AreEqual(expected, result);
        }
Beispiel #2
0
        public void getBackwardsLanguage()
        {
            var englishKeyGetter = new GetTextKey
                                   (
                languageID: englishLanguage.id,
                text_id: TRANSLATION_KEY
                                   );

            string stringToReverse = englishKeyGetter.Parse(justCall(englishKeyGetter));

            Assert.AreEqual(stringToReverse, textToSetTestTokenTo);
            var getText = new GetTextKey
                          (
                languageID: backwardsLanguage.id,
                text_id: TRANSLATION_KEY
                          );
            string reversedString = getText.Parse(justCall(getText));

            Assert.AreNotEqual(stringToReverse, reversedString);
            var    reverser = new WordReverser();
            string manuallyReversedString = reverser.reverseString(stringToReverse);

            Debug.Log(string.Format(" manully reversed:{0} reversed from call{1}", manuallyReversedString, reversedString));
            Assert.AreEqual(manuallyReversedString, reversedString);
        }
Beispiel #3
0
        public void GetVerboseMessage_InputsString_ReturnsDetails()
        {
            string       inputString  = "The quick brown fox";
            WordReverser wordReverser = new WordReverser();
            string       outputString = wordReverser.GetVerboseMessage(inputString);

            Assert.AreEqual("Reversing 4 words with 19 letters in total...", outputString);
        }
Beispiel #4
0
        public void Execute_InputsSentence_WordsReversed()
        {
            string       inputString  = "The quick brown fox";
            WordReverser wordReverser = new WordReverser();
            string       outputString = wordReverser.Execute(inputString);

            Assert.AreEqual("fox brown quick The", outputString);
        }
        public void ReverserReversesNumbersButNotCommas()
        {
            WordReverser reverser = new WordReverser();
            string       s1       = "A comma in 1,234 is different from in a sentence, isn't it?";
            string       expected = "A ammoc ni 432,1 si tnereffid morf ni a ecnetnes, t'nsi ti?";

            reverser.Input = s1;

            string actual = reverser.GetReversedWords();

            Assert.Equal(expected, actual);
        }
        public void ReverserReversesAppostrophiesAndHyphens()
        {
            WordReverser reverser = new WordReverser();

            string s1       = "It's likely to be a F-18s, isn't it?";
            string expected = "s'tI ylekil ot eb a s81-F, t'nsi ti?";

            reverser.Input = s1;

            string actual = reverser.GetReversedWords();

            Assert.Equal(expected, actual);
        }
        public void ReverserDoesSimpleReverse()
        {
            string s1       = "This is a test!";
            string expected = "sihT si a tset!";

            WordReverser reverser = new WordReverser();

            reverser.Input = s1;

            string actual = reverser.GetReversedWords();

            Assert.Equal(expected, actual);
        }
        public void ReverseWordTraditional()
        {
            var names        = new[] { "carlos", "perez" };
            var reverser     = new WordReverser();
            var reverseNames = reverser.Reverse(names).ToArray();

            //Assert.AreEqual("solrac", reverseNames[0]);
            //Assert.AreEqual("zerep", reverseNames[1]);

            //you can also add headers like so
            //Approvals.VerifyAll("header", reverseNames, x => string.Format("{0}", x));

            Approvals.VerifyAll(reverseNames, "Name", x => x.PadLeft(10));
        }
        public void getBackwardsLanguage()
        {
            var englishKeyGetter = new GetTextKey
                (
                languageID: englishLanguage.id,
                text_id: TRANSLATION_KEY
                );

            string stringToReverse = englishKeyGetter.Parse(justCall(englishKeyGetter));
            Assert.AreEqual(stringToReverse, textToSetTestTokenTo);
            var getText = new GetTextKey
                (
                languageID: backwardsLanguage.id,
                text_id: TRANSLATION_KEY
                );
            string reversedString = getText.Parse(justCall(getText));
            Assert.AreNotEqual(stringToReverse, reversedString);
            var reverser = new WordReverser();
            string manuallyReversedString = reverser.reverseString(stringToReverse);
            Debug.Log(string.Format(" manully reversed:{0} reversed from call{1}", manuallyReversedString, reversedString));
            Assert.AreEqual(manuallyReversedString, reversedString);
        }
        public void WordReverserTests()
        {
            IWordReverser wordReverser = new WordReverser();

            RunTests(wordReverser);
        }
 private static void ArrangeActAssert(string given, string expected)
 {
     var wordReverser = new WordReverser();
     string result = wordReverser.Reverse(given);
     Assert.AreEqual(expected, result);
 }
Beispiel #12
0
        public void ReverseWordMethod_String_ReturnsStringWithWordsInReverseOrder(string input, string expected)
        {
            var actual = WordReverser.ReverseWords(input);

            Assert.AreEqual(actual, expected);
        }
Beispiel #13
0
 public WordReverser_ReverseWordsShould()
 {
     _wordReverser = new WordReverser();
 }