public void GivenARunningApiWhenSearchingForACompany()
        {
            var name = "GG";
            var apiKey = Guid.NewGuid().ToString();
            _resource = new MockResource(new ResourceIdentifier("GET", CreateCompaniesPath(), $"?api_key={apiKey}&filters={{\"name\":\"{name}\"}}"));
            _resource.ReturnsBody(JsonSearchResponse);

            _api = new Api();
            _api.RegisterResource(_resource);
            _api.Start();

            var client = new DueDilClientFactory(new DueDilSettings(_api.Uri, apiKey, _sandboxMode)).CreateClient();

            _actual = client.SearchCompaniesAsync(new Terms(){Name = name}).Result;
        }
Esempio n. 2
0
        public void GivenARunningApiWhenGettingACompany()
        {
            var companyId = Guid.NewGuid().ToString();
            var apiKey = Guid.NewGuid().ToString();
            _resource = new MockResource(new ResourceIdentifier("GET", CreateCompanyPath(companyId), $"?api_key={apiKey}"));
            _resource.ReturnsBody(JsonSearchResponse);

            _api = new Api();
            _api.RegisterResource(_resource);
            _api.Start();

            var client = new DueDilClientFactory(new DueDilSettings(_api.Uri, apiKey, _sandboxMode)).CreateClient();

            _actual = client.GetCompanyAsync(Locale.Uk, companyId).Result;
        }