Exemplo n.º 1
0
        static async Task Main(string[] args)
        {
            var httpClient = new HttpClient();

            var archiveTodayClient = new ArchiveTodayClient(httpClient);

            var response = await archiveTodayClient.GetTimemapAsync(new Uri("https://www.bbc.co.uk/"));
        }
Exemplo n.º 2
0
        public void Init()
        {
            var archiveExample = System.IO.File.ReadAllText("./files/archive-is-memento-example.txt");

            var mockHttpMessageHandler = new Mock <HttpMessageHandler>();

            mockHttpMessageHandler
            .Protected()
            .Setup <Task <HttpResponseMessage> >("SendAsync", ItExpr.IsAny <HttpRequestMessage>(), ItExpr.IsAny <CancellationToken>())
            .ReturnsAsync(new HttpResponseMessage
            {
                StatusCode = HttpStatusCode.OK,
                Content    = new StringContent(archiveExample),
            });

            var httpClient = new HttpClient(mockHttpMessageHandler.Object);

            _archiveTodayClient = new ArchiveTodayClient(httpClient);
        }