Use Task.Delay()

This commit is contained in:
Michael Bisbjerg 2020-10-04 01:45:21 +02:00
parent 591f7cd209
commit ab628e5de7
5 changed files with 34 additions and 34 deletions

View File

@ -23,7 +23,7 @@ namespace TMDbLibTests
Assert.True(await TMDbClient.TvEpisodeSetRatingAsync(IdHelper.BreakingBad, 1, 1, 7.5));
// Allow TMDb to cache our changes
Thread.Sleep(2000);
await Task.Delay(2000);
SearchContainer<TvEpisodeWithRating> ratings = await TMDbClient.GetGuestSessionRatedTvEpisodesAsync();
@ -37,7 +37,7 @@ namespace TMDbLibTests
//Assert.True(Config.Client.TvEpisodeSetRatingAsync(IdHelper.BreakingBad, 1, 1, 8));
//// Allow TMDb to cache our changes
//Thread.Sleep(2000);
//await Task.Delay(2000);
//ratings = Config.Client.GetGuestSessionRatedTvEpisodesAsync().Sync();
@ -49,7 +49,7 @@ namespace TMDbLibTests
//Assert.True(Config.Client.TvEpisodeRemoveRatingAsync(IdHelper.BreakingBad, 1, 1));
//// Allow TMDb to cache our changes
//Thread.Sleep(2000);
//await Task.Delay(2000);
//ratings = Config.Client.GetGuestSessionRatedTvEpisodesAsync().Sync();
@ -65,7 +65,7 @@ namespace TMDbLibTests
Assert.True(await TMDbClient.TvShowSetRatingAsync(IdHelper.House, 7.5));
// Allow TMDb to cache our changes
Thread.Sleep(2000);
await Task.Delay(2000);
SearchContainer<SearchTvShowWithRating> ratings = await TMDbClient.GetGuestSessionRatedTvAsync();
@ -77,7 +77,7 @@ namespace TMDbLibTests
Assert.True(await TMDbClient.TvShowSetRatingAsync(IdHelper.House, 8));
// Allow TMDb to cache our changes
Thread.Sleep(2000);
await Task.Delay(2000);
ratings = await TMDbClient.GetGuestSessionRatedTvAsync();
@ -89,7 +89,7 @@ namespace TMDbLibTests
Assert.True(await TMDbClient.TvShowRemoveRatingAsync(IdHelper.House));
// Allow TMDb to cache our changes
Thread.Sleep(2000);
await Task.Delay(2000);
ratings = await TMDbClient.GetGuestSessionRatedTvAsync();
@ -105,7 +105,7 @@ namespace TMDbLibTests
Assert.True(await TMDbClient.MovieSetRatingAsync(IdHelper.Terminator, 7.5));
// Allow TMDb to cache our changes
Thread.Sleep(2000);
await Task.Delay(2000);
SearchContainer<SearchMovieWithRating> ratings = await TMDbClient.GetGuestSessionRatedMoviesAsync();
@ -117,7 +117,7 @@ namespace TMDbLibTests
Assert.True(await TMDbClient.MovieSetRatingAsync(IdHelper.Terminator, 8));
// Allow TMDb to cache our changes
Thread.Sleep(2000);
await Task.Delay(2000);
ratings = await TMDbClient.GetGuestSessionRatedMoviesAsync();
@ -129,7 +129,7 @@ namespace TMDbLibTests
Assert.True(await TMDbClient.MovieRemoveRatingAsync(IdHelper.Terminator));
// Allow TMDb to cache our changes
Thread.Sleep(2000);
await Task.Delay(2000);
ratings = await TMDbClient.GetGuestSessionRatedMoviesAsync();

View File

@ -600,7 +600,7 @@ namespace TMDbLibTests
await TMDbClient.AccountChangeFavoriteStatusAsync(MediaType.Movie, IdHelper.MadMaxFuryRoad, false);
// Allow TMDb to cache our changes
Thread.Sleep(2000);
await Task.Delay(2000);
// Test that the movie is NOT favourited
accountState = await TMDbClient.GetMovieAccountStateAsync(IdHelper.MadMaxFuryRoad);
@ -612,7 +612,7 @@ namespace TMDbLibTests
await TMDbClient.AccountChangeFavoriteStatusAsync(MediaType.Movie, IdHelper.MadMaxFuryRoad, true);
// Allow TMDb to cache our changes
Thread.Sleep(2000);
await Task.Delay(2000);
// Test that the movie IS favourited
accountState = await TMDbClient.GetMovieAccountStateAsync(IdHelper.MadMaxFuryRoad);
@ -631,7 +631,7 @@ namespace TMDbLibTests
await TMDbClient.AccountChangeWatchlistStatusAsync(MediaType.Movie, IdHelper.MadMaxFuryRoad, false);
// Allow TMDb to cache our changes
Thread.Sleep(2000);
await Task.Delay(2000);
// Test that the movie is NOT watchlisted
accountState = await TMDbClient.GetMovieAccountStateAsync(IdHelper.MadMaxFuryRoad);
@ -643,7 +643,7 @@ namespace TMDbLibTests
await TMDbClient.AccountChangeWatchlistStatusAsync(MediaType.Movie, IdHelper.MadMaxFuryRoad, true);
// Allow TMDb to cache our changes
Thread.Sleep(2000);
await Task.Delay(2000);
// Test that the movie IS watchlisted
accountState = await TMDbClient.GetMovieAccountStateAsync(IdHelper.MadMaxFuryRoad);
@ -663,7 +663,7 @@ namespace TMDbLibTests
Assert.True(await TMDbClient.MovieRemoveRatingAsync(IdHelper.MadMaxFuryRoad));
// Allow TMDb to cache our changes
Thread.Sleep(2000);
await Task.Delay(2000);
}
// Test that the movie is NOT rated
@ -676,7 +676,7 @@ namespace TMDbLibTests
await TMDbClient.MovieSetRatingAsync(IdHelper.MadMaxFuryRoad, 5);
// Allow TMDb to cache our changes
Thread.Sleep(2000);
await Task.Delay(2000);
// Test that the movie IS rated
accountState = await TMDbClient.GetMovieAccountStateAsync(IdHelper.MadMaxFuryRoad);
@ -724,7 +724,7 @@ namespace TMDbLibTests
Assert.True(await TMDbClient.MovieSetRatingAsync(IdHelper.Avatar, newRating));
// Allow TMDb to not cache our data
Thread.Sleep(2000);
await Task.Delay(2000);
// Check if it worked
Assert.Equal(newRating, (await TMDbClient.GetMovieAccountStateAsync(IdHelper.Avatar)).Rating);
@ -733,7 +733,7 @@ namespace TMDbLibTests
Assert.True(await TMDbClient.MovieSetRatingAsync(IdHelper.Avatar, originalRating));
// Allow TMDb to not cache our data
Thread.Sleep(2000);
await Task.Delay(2000);
// Check if it worked
Assert.Equal(originalRating, (await TMDbClient.GetMovieAccountStateAsync(IdHelper.Avatar)).Rating);
@ -810,7 +810,7 @@ namespace TMDbLibTests
await TMDbClient.MovieSetRatingAsync(IdHelper.TheDarkKnightRises, 5);
// Allow TMDb to update cache
Thread.Sleep(2000);
await Task.Delay(2000);
movie = await TMDbClient.GetMovieAsync(IdHelper.TheDarkKnightRises, MovieMethods.AccountStates);
}

View File

@ -56,7 +56,7 @@ namespace TMDbLibTests
await TMDbClient.TvEpisodeSetRatingAsync(IdHelper.BigBangTheory, 1, 1, 5);
// Allow TMDb to update cache
Thread.Sleep(2000);
await Task.Delay(2000);
episode = await TMDbClient.GetTvEpisodeAsync(IdHelper.BigBangTheory, 1, 1, TvEpisodeMethods.AccountStates);
}
@ -165,7 +165,7 @@ namespace TMDbLibTests
Assert.True(await TMDbClient.TvEpisodeRemoveRatingAsync(IdHelper.BreakingBad, 1, 1));
// Allow TMDb to cache our changes
Thread.Sleep(2000);
await Task.Delay(2000);
}
// Test that the episode is NOT rated
@ -178,7 +178,7 @@ namespace TMDbLibTests
Assert.True(await TMDbClient.TvEpisodeSetRatingAsync(IdHelper.BreakingBad, 1, 1, 5));
// Allow TMDb to cache our changes
Thread.Sleep(2000);
await Task.Delay(2000);
// Test that the episode IS rated
accountState = await TMDbClient.GetTvEpisodeAccountStateAsync(IdHelper.BreakingBad, 1, 1);

View File

@ -57,7 +57,7 @@ namespace TMDbLibTests
await TMDbClient.TvEpisodeSetRatingAsync(IdHelper.BigBangTheory, 1, 1, 5);
// Allow TMDb to update cache
Thread.Sleep(2000);
await Task.Delay(2000);
season = await TMDbClient.GetTvSeasonAsync(IdHelper.BigBangTheory, 1, TvSeasonMethods.AccountStates);
}
@ -151,7 +151,7 @@ namespace TMDbLibTests
Assert.True(await TMDbClient.TvEpisodeSetRatingAsync(IdHelper.BreakingBad, 1, 3, 3));
// Wait for TMDb to un-cache our value
Thread.Sleep(2000);
await Task.Delay(2000);
// Fetch out the seasons state
ResultContainer<TvEpisodeAccountStateWithNumber> state = await TMDbClient.GetTvSeasonAccountStateAsync(IdHelper.BreakingBad, 1);
@ -167,7 +167,7 @@ namespace TMDbLibTests
Assert.True(await TMDbClient.TvEpisodeRemoveRatingAsync(IdHelper.BreakingBad, 1, 3));
// Wait for TMDb to un-cache our value
Thread.Sleep(2000);
await Task.Delay(2000);
state = await TMDbClient.GetTvSeasonAccountStateAsync(IdHelper.BreakingBad, 1);
Assert.NotNull(state);

View File

@ -192,7 +192,7 @@ namespace TMDbLibTests
await TMDbClient.TvShowSetRatingAsync(IdHelper.BigBangTheory, 5);
// Allow TMDb to update cache
Thread.Sleep(2000);
await Task.Delay(2000);
show = await TMDbClient.GetTvShowAsync(IdHelper.BigBangTheory, TvShowMethods.AccountStates);
}
@ -465,7 +465,7 @@ namespace TMDbLibTests
await TMDbClient.AccountChangeFavoriteStatusAsync(MediaType.Tv, IdHelper.BreakingBad, false);
// Allow TMDb to cache our changes
Thread.Sleep(2000);
await Task.Delay(2000);
// Test that the movie is NOT favourited
accountState = await TMDbClient.GetTvShowAccountStateAsync(IdHelper.BreakingBad);
@ -477,7 +477,7 @@ namespace TMDbLibTests
await TMDbClient.AccountChangeFavoriteStatusAsync(MediaType.Tv, IdHelper.BreakingBad, true);
// Allow TMDb to cache our changes
Thread.Sleep(2000);
await Task.Delay(2000);
// Test that the movie IS favourited
accountState = await TMDbClient.GetTvShowAccountStateAsync(IdHelper.BreakingBad);
@ -496,7 +496,7 @@ namespace TMDbLibTests
await TMDbClient.AccountChangeWatchlistStatusAsync(MediaType.Tv, IdHelper.BreakingBad, false);
// Allow TMDb to cache our changes
Thread.Sleep(2000);
await Task.Delay(2000);
// Test that the movie is NOT watchlisted
accountState = await TMDbClient.GetTvShowAccountStateAsync(IdHelper.BreakingBad);
@ -508,7 +508,7 @@ namespace TMDbLibTests
await TMDbClient.AccountChangeWatchlistStatusAsync(MediaType.Tv, IdHelper.BreakingBad, true);
// Allow TMDb to cache our changes
Thread.Sleep(2000);
await Task.Delay(2000);
// Test that the movie IS watchlisted
accountState = await TMDbClient.GetTvShowAccountStateAsync(IdHelper.BreakingBad);
@ -528,11 +528,11 @@ namespace TMDbLibTests
Assert.True(await TMDbClient.TvShowRemoveRatingAsync(IdHelper.BreakingBad));
// Allow TMDb to cache our changes
Thread.Sleep(2000);
await Task.Delay(2000);
}
// Allow TMDb to cache our changes
Thread.Sleep(2000);
await Task.Delay(2000);
// Test that the movie is NOT rated
accountState = await TMDbClient.GetTvShowAccountStateAsync(IdHelper.BreakingBad);
@ -544,7 +544,7 @@ namespace TMDbLibTests
await TMDbClient.TvShowSetRatingAsync(IdHelper.BreakingBad, 5);
// Allow TMDb to cache our changes
Thread.Sleep(2000);
await Task.Delay(2000);
// Test that the movie IS rated
accountState = await TMDbClient.GetTvShowAccountStateAsync(IdHelper.BreakingBad);
@ -588,7 +588,7 @@ namespace TMDbLibTests
Assert.True(await TMDbClient.TvShowRemoveRatingAsync(IdHelper.BreakingBad));
// Allow TMDb to cache our changes
Thread.Sleep(2000);
await Task.Delay(2000);
}
// Test that the episode is NOT rated
@ -601,7 +601,7 @@ namespace TMDbLibTests
await TMDbClient.TvShowSetRatingAsync(IdHelper.BreakingBad, 5);
// Allow TMDb to cache our changes
Thread.Sleep(2000);
await Task.Delay(2000);
// Test that the episode IS rated
accountState = await TMDbClient.GetTvShowAccountStateAsync(IdHelper.BreakingBad);