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)); }
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); }
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); }