public InMemoryRepository(IMovieIDResolutionService idResolutionService, bool seed = true) { if (seed) { _movies.AddRange(new List <Movie>() { new Movie() { Id = ++_movieUniqueCount, Title = "Jurassic World", Year = 2015 }, new Movie() { Id = ++_movieUniqueCount, Title = "Deadpool", Year = 2016 }, new Movie() { Id = ++_movieUniqueCount, Title = "Iron Man", Year = 2008 }, }); } _idResolution = idResolutionService; }
private static int GetExternalMovieId(IMovieIDResolutionService ideService, String title, ushort year) { int id = -1; try { var task = ideService.GetMovieIdAsync(title, year); task.Wait(); id = task.Result; } catch (AggregateException e) { // swallow exception as we're default to -1 if (e.InnerExceptions.First() is ArgumentException) { throw e.InnerExceptions.First() as ArgumentException; } System.Diagnostics.Debug.Assert(false, "unexpected exception"); } return(id); }
public DbMovieRepository(IMovieIDResolutionService idResolutionService) { _idResolutionService = idResolutionService; }