Пример #1
0
        public void Constructor_WithApiBase_SetsApiBase()
        {
            var apiRoot = "http://example.com";
            var client  = new ErgastClient(apiRoot);

            client.ApiBase.Should().Be(apiRoot);
        }
Пример #2
0
        public ErgastClientTests()
        {
            Cache                   = Substitute.For <IErgastCache>();
            UrlBuilder              = Substitute.For <IUrlBuilder>();
            HttpClient              = Substitute.For <IHttpClient>();
            ResponseMessage         = Substitute.For <HttpResponseMessage>();
            ResponseMessage.Content = new StringContent("{ Data: {} }");

            HttpClient.GetAsync(null).ReturnsForAnyArgs(x => ResponseMessage);

            Client = new ErgastClient
            {
                Cache      = Cache,
                UrlBuilder = UrlBuilder,
                HttpClient = HttpClient
            };
        }