コード例 #1
0
        public void WhenTranslatingASingleWordThenTheFirstLetterIsMovedToTheEndAndFormatted()
        {
            var inputs = new List <string> {
                "pig", "zillion"
            };
            var expectedResults = new List <string> {
                "igpay", "illionzay"
            };

            for (var i = 0; i < inputs.Count; i++)
            {
                var input  = inputs[i];
                var result = PigLatinTranslator.Translate(input);

                Assert.AreEqual(expectedResults[i], result);
            }
        }
コード例 #2
0
        public void SingleWordCases()
        {
            var inputs = new List <string> {
                "Wear,"
            };
            var expectedResults = new List <string> {
                "Earway,"
            };

            for (var i = 0; i < inputs.Count; i++)
            {
                var input  = inputs[i];
                var result = PigLatinTranslator.Translate(input);

                Assert.AreEqual(expectedResults[i], result);
            }
        }
コード例 #3
0
        public void WhenTranslatingMultipleWordsThenEachWordIsTransformedCorrectly()
        {
            var inputs = new List <string> {
                "wear it with confidence"
            };
            var expectedResults = new List <string> {
                "earway itay ithway onfidencecay"
            };

            for (var i = 0; i < inputs.Count; i++)
            {
                var input  = inputs[i];
                var result = PigLatinTranslator.Translate(input);

                Assert.AreEqual(expectedResults[i], result);
            }
        }
コード例 #4
0
        public void WhenTranslatingAWordAndTheWordStartsWithAConsonantClusterThenTheClusterIsMovedToTheEndAndAYAppended()
        {
            var inputs = new List <string> {
                "clasp", "chrome"
            };
            var expectedResults = new List <string> {
                "aspclay", "omechray"
            };

            for (var i = 0; i < inputs.Count; i++)
            {
                var input  = inputs[i];
                var result = PigLatinTranslator.Translate(input);

                Assert.AreEqual(expectedResults[i], result);
            }
        }
コード例 #5
0
        public void WhenTranslatingAndTheWordStartsWithAVowelThenAYIsAppended()
        {
            var inputs = new List <string> {
                "earring"
            };
            var expectedResults = new List <string> {
                "earringay"
            };

            for (var i = 0; i < inputs.Count; i++)
            {
                var input  = inputs[i];
                var result = PigLatinTranslator.Translate(input);

                Assert.AreEqual(expectedResults[i], result);
            }
        }
コード例 #6
0
        public void WhenTranslatingMultipleWordsThenCapitilizationAndPunctuationIsMaintained()
        {
            var inputs = new List <string> {
                "Wear, it with confidence."
            };
            var expectedResults = new List <string> {
                "Earway, itay ithway onfidencecay."
            };

            for (var i = 0; i < inputs.Count; i++)
            {
                var input  = inputs[i];
                var result = PigLatinTranslator.Translate(input);

                Assert.AreEqual(expectedResults[i], result);
            }
        }