Beispiel #1
0
        public void RForRandomJokesPath4()
        {
            JokeFlowOverride jokeFlow = new JokeFlowOverride
            {
                // set the input buffer with the input that would be keyed in.
                inputBuffer  = new List <string>(new string[] { "r", "n", "n", "9", "q" }),
                outputBuffer = new List <string>()
            };

            jokeFlow.Flow();

            // check that the output buffer has the correct data in it.
            Assert.Equal(Questions.Instructions, jokeFlow.outputBuffer[0]);
            Assert.Equal(Questions.WantToUseRandomName, jokeFlow.outputBuffer[1]);
            Assert.Equal(Questions.WantToSpecifyCategory, jokeFlow.outputBuffer[2]);
            Assert.Equal(Questions.HowManyJokes, jokeFlow.outputBuffer[3]);
            Assert.NotNull(jokeFlow.outputBuffer[4]);
            Assert.Contains("chuck norris", jokeFlow.outputBuffer[4].ToLower());
            Assert.Contains("chuck norris", jokeFlow.outputBuffer[5].ToLower());
            Assert.Contains("chuck norris", jokeFlow.outputBuffer[6].ToLower());
            Assert.Contains("chuck norris", jokeFlow.outputBuffer[7].ToLower());
            Assert.Contains("chuck norris", jokeFlow.outputBuffer[8].ToLower());
            Assert.Contains("chuck norris", jokeFlow.outputBuffer[9].ToLower());
            Assert.Contains("chuck norris", jokeFlow.outputBuffer[10].ToLower());
            Assert.Contains("chuck norris", jokeFlow.outputBuffer[11].ToLower());
            Assert.Contains("chuck norris", jokeFlow.outputBuffer[12].ToLower());

            Assert.Equal(Questions.QuitText, jokeFlow.outputBuffer[13]);
        }
Beispiel #2
0
        public void QForQuit()
        {
            JokeFlowOverride jokeFlow = new JokeFlowOverride
            {
                // set the input buffer with the input that would be keyed in.
                inputBuffer  = new List <string>(new string[] { "q" }),
                outputBuffer = new List <string>()
            };

            jokeFlow.Flow();

            // check that the output buffer has the correct data in it.
            Assert.Equal(Questions.QuitText, jokeFlow.outputBuffer[1]);
        }
Beispiel #3
0
        public void CForCategories()
        {
            JokeFlowOverride jokeFlow = new JokeFlowOverride
            {
                // set the input buffer with the input that would be keyed in.
                inputBuffer  = new List <string>(new string[] { "c", "q" }),
                outputBuffer = new List <string>()
            };

            jokeFlow.Flow();

            // check that the output buffer has the correct data in it.
            Assert.Equal(Questions.CategoryTitle, jokeFlow.outputBuffer[1]);
        }
Beispiel #4
0
        public void RForRandomJokesPath3()
        {
            JokeFlowOverride jokeFlow = new JokeFlowOverride
            {
                // set the input buffer with the input that would be keyed in.
                inputBuffer  = new List <string>(new string[] { "r", "y", "y", "InvalidInvalid", "dev", "1", "q" }),
                outputBuffer = new List <string>()
            };

            jokeFlow.Flow();

            // check that the output buffer has the correct data in it.
            Assert.Equal(Questions.Instructions, jokeFlow.outputBuffer[0]);
            Assert.Equal(Questions.WantToUseRandomName, jokeFlow.outputBuffer[1]);
            Assert.Equal(Questions.WantToSpecifyCategory, jokeFlow.outputBuffer[2]);
            Assert.Equal(Questions.EnterCategory, jokeFlow.outputBuffer[3]);
            Assert.Equal(Questions.InvalidCategory.Replace("category", "InvalidInvalid"), jokeFlow.outputBuffer[4]);
        }
Beispiel #5
0
        public void RForRandomJokesPathNoInfinteLoop()
        {
            JokeFlowOverride jokeFlow = new JokeFlowOverride
            {
                // set the input buffer with the input that would be keyed in.
                inputBuffer  = new List <string>(new string[] { "r", "n", "y", "money", "9", "q" }),
                outputBuffer = new List <string>()
            };

            jokeFlow.Flow();

            // check that the output buffer has the correct data in it.
            Assert.Equal(Questions.Instructions, jokeFlow.outputBuffer[0]);
            Assert.Equal(Questions.WantToUseRandomName, jokeFlow.outputBuffer[1]);
            Assert.Equal(Questions.WantToSpecifyCategory, jokeFlow.outputBuffer[2]);
            Assert.Equal(Questions.EnterCategory, jokeFlow.outputBuffer[3]);
            Assert.Equal(Questions.HowManyJokes, jokeFlow.outputBuffer[4]);
            Assert.Contains("chuck norris", jokeFlow.outputBuffer[5].ToLower());
            Assert.Contains("chuck norris", jokeFlow.outputBuffer[6].ToLower());
            // despite asking for 9 jokes, there are only 2 jokes from the api
            Assert.Equal(Questions.QuitText, jokeFlow.outputBuffer[7]);
        }