public void TestGetUrlTitleReturnsValidUrl() { var(success, url, exception) = _omdbService.GetUrl(_fakeAPIKey, "matrix", "", null); Assert.IsTrue(success); Assert.AreEqual("http://www.omdbapi.com/?i=tt3896198&apikey=FakeApiKey&t=matrix", url); Assert.IsNull(exception); }
private string GetUrl(string title, string year, Plot?plot) { var appSettings = HttpContext.RequestServices.GetRequiredService <IConfiguration>(); var apiKey = appSettings.GetValue <string>("ApiKey"); var(success, url, exception) = _omdbService.GetUrl(apiKey, title, year, plot); if (!success && exception != null) { throw new Exception(exception.Message); } return(url); }