コード例 #1
0
        public void GetRandomJokesTestHappyPath()
        {
            var jsonFeed = new JsonFeed(nameGeneratorURL, 0);

            string[] jokes = JsonFeed.GetRandomJokes(firstName, lastName, null);

            Assert.IsTrue(jokes.Length > 0);
            Assert.IsTrue(jokes[0].Contains(firstName) && jokes[0].Contains(lastName));
        }
コード例 #2
0
        public async Task <List <string> > GetRandomJokes(string category, int number, Tuple <string, string> names)
        {
            var feed  = new JsonFeed("https://api.chucknorris.io");
            var jokes = new List <String>();

            for (var i = 0; i < number; i++)
            {
                var result = await feed.GetRandomJokes(names?.Item1, names?.Item2, category);

                jokes.Add(result);
            }
            return(jokes);
        }
コード例 #3
0
        public void GetRandomJokes()// (string[] expectedResult)
        {
            var request = new JokeRequest();

            request.FirstName = "Maggie";
            request.LastName  = "Chen";
            request.Category  = "animal"; // "aminal";
            request.Uri       = "https://api.chucknorris.io";
            var feed = new JsonFeed();    // ("https://api.chucknorris.io");//, 1);
            var res  = feed.GetRandomJokes(request);

            Assert.IsNotNull(res);

            //mockFeed = new Mock<IJsonFeed>(MockBehavior.Strict);
            //mockFeed.Setup(p => p.GetRandomJokes(request)).Returns(expectedResult);

            //systemUnderTest = new JsonFeed();
            //var result = systemUnderTest.GetRandomJokes(request);
            //Assert.IsNotNull(result);
        }