public async Task browse_async_calls_httpclient_with_defined_uri_if_cache_get_returns_null()
        {
            //Given
            var expectedUri = new Uri("https://financialmodelingprep.com/api/v3/company/stock/list");

            var handlerMock = new Mock <HttpMessageHandler>(MockBehavior.Strict);

            handlerMock.Protected()
            // Setup the PROTECTED method to mock
            .Setup <Task <HttpResponseMessage> >(
                "SendAsync",
                ItExpr.IsAny <HttpRequestMessage>(),
                ItExpr.IsAny <CancellationToken>()
                )
            // prepare the expected response of the mocked http call
            .ReturnsAsync(new HttpResponseMessage()
            {
                StatusCode = HttpStatusCode.OK,
                Content    = new StringContent("{\n  \"symbolsList\" : [ {\n    \"symbol\" : \"SPY\",\n    \"name\" : \"SPDR S&P 500\",\n    \"price\" : 299.39\n  }, {\n    \"symbol\" : \"CMCSA\",\n    \"name\" : \"Comcast Corporation Class A Common Stock\",\n    \"price\" : 45.54\n  } ]\n}")
            })
            .Verifiable();

            // use real http client with mocked handler here
            var httpClinet = new HttpClient(handlerMock.Object)
            {
                BaseAddress = new Uri("https://financialmodelingprep.com")
            };

            var memoryCacheMock = MockMemoryCacheService.RegisterMemoryCache(null);

            var sut = new FinancialModelingPrepRepository(httpClinet,
                                                          memoryCacheMock.Object);

            //When
            var result = await sut.BrowseAsync();

            //Then
            result.Should().NotBeNull();
            handlerMock.Protected().Verify(
                "SendAsync",
                Times.Exactly(1), // we expected a single external request
                ItExpr.Is <HttpRequestMessage>(req =>
                                               req.Method == HttpMethod.Get && // we expected a GET request
                                               req.RequestUri == expectedUri // to this uri
                                               ),
                ItExpr.IsAny <CancellationToken>()
                );
            MockMemoryCacheService.GetMethodWasCalledOnce(memoryCacheMock);
        }
        public async Task browse_async_checks_if_cache_contains_proper_data()
        {
            //Given
            var cacheResult = new List <Company>();

            var httpClientMock = new Mock <HttpClient>();

            var memoryCacheMock =
                MockMemoryCacheService.RegisterMemoryCache(cacheResult);

            var sut = new FinancialModelingPrepRepository(httpClientMock.Object,
                                                          memoryCacheMock.Object);

            //When
            var result = await sut.BrowseAsync();

            //Then
            MockMemoryCacheService.GetMethodWasCalledOnce(memoryCacheMock);
            result.Should().BeSameAs(cacheResult);
        }