public void GetNamesTest(int count)
        {
            var options  = GetOptions();
            var provider = new JokeWebApiClient(options);
            var result   = provider.GetNames(count);

            Assert.AreEqual(count, result.Count);
        }
        public void GetBothNamesJokesTest(int count)
        {
            var options      = GetOptions();
            var jokeProvider = new JokeWebApiClient(options);
            var jr           = new JokeRequest("Thomas", "Crane", "food", count);
            var results      = jokeProvider.GetJokes(jr);

            Assert.AreEqual(count, results.Count);
        }
        public void GetJokesWithLastNameOnlyTest(int count)
        {
            var options      = GetOptions();
            var jokeProvider = new JokeWebApiClient(options);
            var jr           = new JokeRequest(null, "Crane", "food", count);
            var results      = jokeProvider.GetJokes(jr);

            Assert.AreEqual(count, results.Count);
        }
        public void GetJokesWithFirstNameOnlyTest(int count)
        {
            var options      = GetOptions();
            var jokeProvider = new JokeWebApiClient(options);
            var jr           = new JokeRequest("Thomas", null, "movie", count);
            var results      = jokeProvider.GetJokes(jr);

            Assert.AreEqual(count, results.Count);
        }
        public void GetAnyRandomJokesTest(int count)
        {
            var options      = GetOptions();
            var jokeProvider = new JokeWebApiClient(options);
            var jr           = new JokeRequest(count);
            var results      = jokeProvider.GetJokes(jr);

            Assert.AreEqual(count, results.Count);
        }
        public void GetJustCategoryDefaultNameJokesTest(int count)
        {
            var options      = GetOptions();
            var jokeProvider = new JokeWebApiClient(options);
            var jr           = new JokeRequest("animal", count);
            var results      = jokeProvider.GetJokes(jr);

            Assert.AreEqual(count, results.Count);
        }
示例#7
0
        public void GetAllCategoriesTest()
        {
            var options = Substitute.For <IOptions <JokeGeneratorSettings> >();

            options.Value.Returns(new JokeGeneratorSettings
            {
                NamesUrl       = "https://api.chucknorris.io",
                ChucknorrisUrl = "https://api.chucknorris.io"
            });
            var categoryProvider = new JokeWebApiClient(options);
            var result           = categoryProvider.GetCategories();

            Assert.IsNotNull(result);
            Assert.AreNotEqual(0, result.Count);
        }