public async Task Provider_Search_Sets_Image_Urls_To_Https(string author, string title) { var volumeInfo = new Volume.VolumeInfoData { ImageLinks = new Volume.VolumeInfoData.ImageLinksData { Medium = "http://image.com" } }; var volume = _fixture .Build <Volume>() .With(v => v.VolumeInfo, volumeInfo) .Create(); var volumes = _fixture .Build <Volumes>() .With(v => v.Items, new List <Volume> { volume }) .Create(); _apiClient.Setup(x => x.Search(author, title)).ReturnsAsync(Result.Success(volumes)); var result = await _provider.Search(author, title); result.IsSuccess.Should().BeTrue(); result.Value.All(x => x.ImageUrl.StartsWith("https")).Should().BeTrue(); }
public async Task Provider_Search_Returns_Search_Results(string author, string title) { var volumeInfo = new Volume.VolumeInfoData { PublishedDate = DateTimeOffset.UtcNow.ToString("s") }; var volume = _fixture .Build <Volume>() .With(v => v.VolumeInfo, volumeInfo) .Create(); var volumes = _fixture .Build <Volumes>() .With(v => v.Items, new List <Volume> { volume }) .Create(); _apiClient.Setup(x => x.Search(author, title)).ReturnsAsync(Result.Success(volumes)); var result = await _provider.Search(author, title); result.IsSuccess.Should().BeTrue(); result.Value.Should().NotBeEmpty(); }
public async Task Provider_Get_Volume_Sets_Image_Url_To_Https(string id) { var volumeInfo = new Volume.VolumeInfoData { ImageLinks = new Volume.VolumeInfoData.ImageLinksData { Medium = "http://image.com" } }; var volume = _fixture .Build <Volume>() .With(v => v.VolumeInfo, volumeInfo) .Create(); _apiClient.Setup(x => x.GetById(id)).ReturnsAsync(Result.Success(volume)); var result = await _provider.GetVolumeById(id); result.IsSuccess.Should().BeTrue(); result.Value.ImageUrl.Should().StartWith("https:"); }