private async Task SearchWithSearchCriteriaAsync(SearchCriteria searchCriteria)
        {
            var client  = new ApiControllerAClient();
            var results = await client.SearchAsync(searchCriteria).ConfigureAwait(false);

            Assert.IsTrue(results.Any());
        }
        public async Task ResponseObtainedAsync()
        {
            var searchCriteria = new SearchCriteria()
            {
                Title = "Road Trip"
            };

            var client  = new ApiControllerAClient();
            var results = await client.SearchAsync(searchCriteria).ConfigureAwait(false);

            Assert.IsTrue(results.Any());
        }
Example #3
0
        public async Task ResponseObtainedForValidSearchCriteriaAsync()
        {
            var searchCriteria = new SearchCriteria()
            {
                Title = "Road Trip"
            };
            var apiControllerAClient = new ApiControllerAClient();
            var movies = await apiControllerAClient.SearchAsync(searchCriteria).ConfigureAwait(false);

            Assert.AreEqual(1, movies.Count);
            var roadTrip = movies.FirstOrDefault();

            Assert.IsNotNull(roadTrip);

            var original = roadTrip.AverageRating;

            var apiControllerDClient = new ApiControllerDClient();
            await apiControllerDClient.AddOrUpdateRatingAsync(1, 3, 1.2M).ConfigureAwait(false);

            movies = await apiControllerAClient.SearchAsync(searchCriteria).ConfigureAwait(false);

            Assert.AreEqual(1, movies.Count);
            roadTrip = movies.FirstOrDefault();
            Assert.IsNotNull(roadTrip);

            Assert.IsFalse(original == roadTrip.AverageRating);

            await apiControllerDClient.AddOrUpdateRatingAsync(1, 3, 1).ConfigureAwait(false);

            movies = await apiControllerAClient.SearchAsync(searchCriteria).ConfigureAwait(false);

            Assert.AreEqual(1, movies.Count);
            roadTrip = movies.FirstOrDefault();
            Assert.IsNotNull(roadTrip);

            Assert.IsTrue(original == roadTrip.AverageRating);
        }