Esempio n. 1
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);
        }
Esempio n. 2
0
 private async Task AddOrUpdateRatingsAsync(int movieId, int userId, decimal rating)
 {
     var apiControllerDClient = new ApiControllerDClient();
     await apiControllerDClient.AddOrUpdateRatingAsync(movieId, userId, rating).ConfigureAwait(false);
 }