static void Main(string[] args) { ConsoleHelper.WriteLineColorGreen("Access Token : " + args[1]); ConsoleHelper.WriteLineColorGreen("Album Id : " + args[0]); Console.WriteLine(); var argsData = new ArgumentModel { AccessToken = args[1], AlbumId = args[0] }; HandleException.Run(() => { IHttpClientService connectionClient = new HttpClientService(); IFacebookCore worker = new FacebookCore(argsData, connectionClient); ConsoleHelper.WriteLineColorBlue("Fetching all photo in album ..."); var allPhotoList = worker.GetAllPhotoList(); using (var webClient = new WebClient()) { ConsoleHelper.WriteLineColorBlue("Downloading photo ..."); IDownloader downloader = new Downloader(webClient); downloader.StartDownloadFile(allPhotoList); } Console.WriteLine("Done!"); }); }
public void Fetch_Api_Test() { var mockHttp = new MockHttpMessageHandler(); mockHttp.When("*") .Respond("application/json", GenerateRawJson()); var client = mockHttp.ToHttpClient(); IHttpClientService httpClient = new HttpClientService(client); IFacebookCore fbApi = new FacebookCore(new ArgumentModel(), httpClient); var expectedResult = GenerateMockData(); var actualResult = fbApi.GetAllPhotoList(); Assert.Equal(expectedResult.Select(x => x.Data).Count(), actualResult.Select(x => x.Data).Count()); }