public void IntegrationSetUp() { TempDirectory = Path.Combine(TestContext.CurrentContext.TestDirectory, "_test_" + TestBase.GetUID()); // Wait for things to get quiet, otherwise the previous test might influence the current one. Commands.WaitAll(); }
public void IntegrationSetUp() { TempDirectory = Path.Combine(TestContext.CurrentContext.TestDirectory, "_test_" + Process.GetCurrentProcess().Id + "_" + DateTime.UtcNow.Ticks); // Wait for things to get quiet, otherwise the previous test might influence the current one. Commands.WaitAll(); }
public MovieResource EnsureMovie(int tmdbid, string movieTitle, bool?monitored = null) { var result = Movies.All().FirstOrDefault(v => v.TmdbId == tmdbid); if (result == null) { var lookup = Movies.Lookup("tmdb:" + tmdbid); var movie = lookup.First(); movie.ProfileId = 1; movie.Path = Path.Combine(MovieRootFolder, movie.Title); movie.Monitored = true; movie.AddOptions = new Core.Movies.AddMovieOptions(); Directory.CreateDirectory(movie.Path); result = Movies.Post(movie); Commands.WaitAll(); } if (monitored.HasValue) { var changed = false; if (result.Monitored != monitored.Value) { result.Monitored = monitored.Value; changed = true; } if (changed) { Movies.Put(result); } } return(result); }
public SeriesResource EnsureSeries(int tvdbId, string seriesTitle, bool?monitored = null) { var result = Series.All().FirstOrDefault(v => v.TvdbId == tvdbId); if (result == null) { var lookup = Series.Lookup("tvdb:" + tvdbId); var series = lookup.First(); series.ProfileId = 1; series.Path = Path.Combine(SeriesRootFolder, series.Title); series.Monitored = true; series.Seasons.ForEach(v => v.Monitored = true); series.AddOptions = new Core.Tv.AddSeriesOptions(); Directory.CreateDirectory(series.Path); result = Series.Post(series); Commands.WaitAll(); WaitForCompletion(() => Episodes.GetEpisodesInSeries(result.Id).Count > 0); } if (monitored.HasValue) { var changed = false; if (result.Monitored != monitored.Value) { result.Monitored = monitored.Value; changed = true; } result.Seasons.ForEach(season => { if (season.Monitored != monitored.Value) { season.Monitored = monitored.Value; changed = true; } }); if (changed) { Series.Put(result); } } return(result); }