コード例 #1
0
        private static WhoisEnhancedRecord WhoisEnhanced(string ipAddress, string filters, string referrer)
        {
            if (filters != null)
            {
                filters = filters.Scrub();
                Assert.ValidInput(filters, "filters");
            }
            if (referrer != null)
            {
                referrer = referrer.Scrub();
                Assert.ValidInput(referrer, "referrer");
            }

            var hash = BuildHashKey(ipAddress, filters);

            if (ServiceCache.IsInCache <WhoisEnhancedRecord>(hash))
            {
                var cachedRecord = (WhoisEnhancedRecord)ServiceCache.GetFromCache <WhoisEnhancedRecord>(hash);
                if (cachedRecord != null)
                {
                    return(cachedRecord);
                }
            }

            var whoisEnhancedRecord = new WhoisEnhancedRecord(Whois(ipAddress), filters, referrer);

            return(whoisEnhancedRecord.AddToCache(hash));
        }
コード例 #2
0
 public ControllerBase([CreateNew] IController parent)
 {
     Parent      = parent;
     Controllers = new ControllerCache(parent);
     Services    = new ServiceCache(parent);
     Views       = new ViewCache(parent);
 }
コード例 #3
0
        private static WhoisRecord Whois(string ipAddress)
        {
            ipAddress = ipAddress.Scrub();
            if (string.IsNullOrEmpty(ipAddress))
            {
                ipAddress = GetIpAddressFromRequest(ipAddress);
            }
            Assert.ValidInput(ipAddress, "ipAddress");

            if (ServiceCache.IsInCache <WhoisRecord>(ipAddress))
            {
                var cachedRecord = (WhoisRecord)ServiceCache.GetFromCache <WhoisRecord>(ipAddress);
                if (cachedRecord != null)
                {
                    return(cachedRecord);
                }
            }

            var whoisClient = new WhoisClient(ipAddress);
            var record      = whoisClient.GetWhoisRecord();

            HandleErrors(whoisClient.Errors);

            return(record.AddToCache(ipAddress));
        }
コード例 #4
0
        private static Resume Resume(string firstnameLastname)
        {
            Assert.ValidInput(firstnameLastname, "firstname-lastname");

            firstnameLastname = firstnameLastname.Scrub();

            if (ServiceCache.IsInCache <Resume>(firstnameLastname))
            {
                var cachedResume = (Resume)ServiceCache.GetFromCache <Resume>(firstnameLastname);
                if (cachedResume != null)
                {
                    return(cachedResume);
                }
            }

            var linkedInEmailAddress = ConfigurationManager.AppSettings["LinkedInEmailAddress"];
            var linkedInPassword     = ConfigurationManager.AppSettings["LinkedInPassword"];

            var resumeSniffer = new LinkedInResumeSniffer(linkedInEmailAddress, linkedInPassword, firstnameLastname);

            Resume resume = null;

            try
            {
                resume = resumeSniffer.GetResume();
            }
            catch (Exception)
            {
                HandleErrors(linkedInEmailAddress);
            }

            HandleErrors(resumeSniffer.Errors);

            return(resume.AddToCache(firstnameLastname));
        }
コード例 #5
0
 public Client(NetworkInterface networkInterface)
 {
     network_interface_info = NetworkInterfaceInfo.GetNetworkInterfaceInfo(networkInterface);
     service_cache          = new ServiceCache(this);
     notify_listener        = new NotifyListener(this);
     browsers = new Dictionary <string, Browser> ();
 }
コード例 #6
0
        public IEnumerable <ServiceCache> GetServiceCaches()
        {
            var cacheWrapperSetting = AppConfig.Configuration.Get <CachingProvider>();
            var bingingSettings     = cacheWrapperSetting.CachingSettings;
            var serviceCaches       = new List <ServiceCache>();

            foreach (var setting in bingingSettings)
            {
                var context = _serviceProvider.GetInstances <RedisContext>(setting.Id);
                foreach (var type in context.dicHash.Keys)
                {
                    var cacheDescriptor = new CacheDescriptor
                    {
                        Id     = $"{setting.Id}.{type.ToString()}",
                        Prefix = setting.Id,
                        Type   = type
                    };
                    int.TryParse(context.DefaultExpireTime, out int defaultExpireTime);
                    int.TryParse(context.ConnectTimeout, out int connectTimeout);
                    cacheDescriptor.DefaultExpireTime(defaultExpireTime);
                    cacheDescriptor.ConnectTimeout(connectTimeout);
                    var serviceCache = new ServiceCache
                    {
                        CacheDescriptor = cacheDescriptor,
                        CacheEndpoint   = context.dicHash[type].GetNodes()
                    };
                    serviceCaches.Add(serviceCache);
                }
            }
            return(serviceCaches);
        }
コード例 #7
0
        private void SaveConfiguration(ServiceCache cache)
        {
            if (this.queue.Count > 0)
            {
                this.queue.Dequeue();
            }
            var setting = _cachingProvider.CachingSettings.Where(p => p.Id == cache.CacheDescriptor.Prefix).FirstOrDefault();

            setting.Properties.ForEach(p =>
            {
                if (p.Maps != null)
                {
                    p.Maps.ForEach(m =>
                    {
                        if (m.Name == cache.CacheDescriptor.Type)
                        {
                            m.Properties = cache.CacheEndpoint.Select(n =>
                            {
                                var hashNode = n as ConsistentHashNode;
                                return(new Property
                                {
                                    Value = $"{hashNode.Host}:{hashNode.Port}::{hashNode.Db}"
                                });
                            }).ToList();
                        }
                    });
                }
            });
            this.queue.Enqueue(true);
        }
コード例 #8
0
        public void OneRecordRefreshed()
        {
            var name       = "scooby.doo.local";
            var recordType = 1;
            var ttl        = 1;

            var timer        = new Mock <ITimer>();
            var serviceCache = new ServiceCache(timer.Object);
            var packet       = CreatePacket(new[] { new Tuple <string, int, int>(name, recordType, ttl) });
            var verified     = true;

            serviceCache.AddPacket(packet);

            serviceCache.RequestUpdate += (x) =>
            {
                if (x.Length != 0)
                {
                    verified = false;
                }
            };
            Thread.Sleep(1000);

            var packet2 = CreatePacket(new[] { new Tuple <string, int, int>(name, recordType, ttl * 10) });

            serviceCache.AddPacket(packet2);

            timer.Raise(x => x.Fired += null);
            Assert.IsTrue(verified);
        }
コード例 #9
0
        public void ShouldTestThatKeyUsesObjectName()
        {
            var hash = ServiceCache.Hash <MyTestObject>("dude");

            Assert.IsTrue(hash.Contains("MyTestObject"));
            Assert.IsTrue(hash.Contains("dude"));
            Console.Write(hash);
        }
コード例 #10
0
 private static T GetFromCache <T>(string key)
 {
     if (ServiceCache.IsInCache <T>(key))
     {
         return((T)ServiceCache.GetFromCache <T>(key));
     }
     return(default(T));
 }
コード例 #11
0
        /// <summary>
        /// 添加自定义的Repository服务,完成dbcontext的注入,Repository的注入
        /// </summary>
        /// <param name="services"></param>
        /// <param name="action"></param>
        public static void AddCache(this IServiceCollection services, Action <OptionsCache> action)
        {
            OptionsCache options = new OptionsCache();

            action.Invoke(options);
            ServiceCache srv = new ServiceCache(services, options);

            srv.LoadCache();
        }
コード例 #12
0
ファイル: Connect.cs プロジェクト: imzjy/internals-viewer
        public void OnConnection(object application, ext_ConnectMode connectMode, object addInInst, ref Array custom)
        {
            addInInstance     = (AddIn)addInInst;
            applicationObject = (DTE2)addInInstance.DTE;

            switch (connectMode)
            {
            case ext_ConnectMode.ext_cm_Startup:

                Commands2 commands = (Commands2)applicationObject.Commands;

                CommandBar menuBarCommandBar  = ((CommandBars)applicationObject.CommandBars)["MenuBar"];
                CommandBar standardCommandBar = ((CommandBars)applicationObject.CommandBars)["Standard"];

                this.openViewerButton = AddCommandBarButton(commands,
                                                            standardCommandBar,
                                                            "OpenInternalsViewer",
                                                            "Open Internals Viewer",
                                                            Properties.Resources.allocationMapIcon,
                                                            Properties.Resources.allocationMapIconMask);

                CommandBarPopup commandBarPopup = (CommandBarPopup)menuBarCommandBar.Controls.Add(MsoControlType.msoControlPopup,
                                                                                                  System.Type.Missing,
                                                                                                  System.Type.Missing,
                                                                                                  8,
                                                                                                  Properties.Resources.AppWindow);
                commandBarPopup.Caption = "Internals Viewer";

                AddCommandBarPopup(commands,
                                   commandBarPopup,
                                   "AllocationMap",
                                   "Allocation Map",
                                   "Show the Allocation Map",
                                   Properties.Resources.allocationMapIcon,
                                   Properties.Resources.allocationMapIconMask);

                AddCommandBarPopup(commands,
                                   commandBarPopup,
                                   "TransactionLog",
                                   "Display Transaction Log",
                                   "Include the Transaction Log with query results",
                                   Properties.Resources.TransactionLogIcon,
                                   Properties.Resources.allocationMapIconMask);

                IObjectExplorerEventProvider provider = ServiceCache.GetObjectExplorer().GetService(typeof(IObjectExplorerEventProvider)) as IObjectExplorerEventProvider;

                provider.NodesRefreshed     += new NodesChangedEventHandler(Provider_NodesRefreshed);
                provider.NodesAdded         += new NodesChangedEventHandler(Provider_NodesRefreshed);
                provider.BufferedNodesAdded += new NodesChangedEventHandler(Provider_NodesRefreshed);

                this.windowManager       = new WindowManager(applicationObject, addInInstance);
                this.queryEditorExtender = new QueryEditorExtender(applicationObject, this.windowManager);

                break;
            }
        }
コード例 #13
0
        public void CanRegisterService()
        {
            var cache = new ServiceCache();

            cache.Register(new ServiceIdentity {
                ServiceName = "test", Location = "/"
            });

            Assert.Equal(1, cache.Keys.Count);
        }
コード例 #14
0
        /// <summary>
        /// Gets the object explorer selected nodes.
        /// </summary>
        /// <returns></returns>
        private INodeInformation[] GetObjectExplorerSelectedNodes()
        {
            IObjectExplorerService objExplorer = ServiceCache.GetObjectExplorer();
            int arraySize;

            INodeInformation[] nodes;

            objExplorer.GetSelectedNodes(out arraySize, out nodes);

            return(nodes);
        }
コード例 #15
0
        public ServicesController()
        {
            _services = new ServiceCache();

            _services.Register(new ServiceIdentity {
                ServiceName = "positions"
            });
            _services.Register(new ServiceIdentity {
                ServiceName = "exposures"
            });
        }
コード例 #16
0
        public void RegisterAssignsInstanceKey()
        {
            var service = new ServiceIdentity {
                ServiceName = "FOO"
            };
            var cache = new ServiceCache();

            cache.Register(service);

            Assert.NotEmpty(service.InstanceKey);
        }
コード例 #17
0
        private async Task <ServiceCache> GetCache(string path)
        {
            ServiceCache result  = null;
            var          watcher = new NodeMonitorWatcher(_zooKeeper, path,
                                                          async(oldData, newData) => await NodeChange(oldData, newData));

            if (await _zooKeeper.existsAsync(path) != null)
            {
                var data = (await _zooKeeper.getDataAsync(path, watcher)).Data;
                watcher.SetCurrentData(data);
                result = await GetCache(data);
            }
            return(result);
        }
コード例 #18
0
        public async Task <List <MicroService> > GetAsync([NotNull] string service, CancellationToken cancellationToken = default)
        {
            Check.NotNullOrWhiteSpace(service, nameof(service));
            var key      = GetCacheKey();
            var services = await ServiceCache.GetAsync(key, token : cancellationToken);

            if (services == null)
            {
                await Poll();
            }

            services = await ServiceCache.GetAsync(key);

            return(services);
        }
コード例 #19
0
        /// <summary>
        /// Gets the object explorer tree view.
        /// </summary>
        /// <returns></returns>
        private TreeView GetObjectExplorerTreeView()
        {
            Type t = ServiceCache.GetObjectExplorer().GetType();

            FieldInfo field = t.GetField("tree", BindingFlags.NonPublic | BindingFlags.Instance);

            if (field != null)
            {
                return((TreeView)field.GetValue(ServiceCache.GetObjectExplorer()));
            }
            else
            {
                return(null);
            }
        }
コード例 #20
0
        private async Task Poll()
        {
            var services = await ConsulDiscoveryService.GetAsync(Option.Service);

            if (services == null)
            {
                services = new List <MicroService>();
            }

            var key = GetCacheKey();
            await ServiceCache.SetAsync(key, services, new DistributedCacheEntryOptions()
            {
                AbsoluteExpirationRelativeToNow = TimeSpan.FromSeconds(Option.Expires)
            });
        }
コード例 #21
0
        public static void Dispose()
        {
            if (instance != null)
            {
                ServiceCache.EventBus.StopCurrentEventPropagation();
                instance.container.Dispose();
                ServiceCache.Dispose();

                instance.servicesRegistered.Clear();
                instance.servicesLoaded.Clear();
                instance = null;

                OnDisposed();
                OnDisposed = delegate { };
            }
        }
コード例 #22
0
ファイル: ServicePool.cs プロジェクト: DropletProject/Droplet
        private async Task <IEnumerable <ServiceInformation> > GetServicesAsync(string name, string version)
        {
            if (_serviceCache.TryGetValue(name, out ServiceCache serviceCache))
            {
                if (serviceCache.RefreshTime > DateTime.Now)
                {
                    return(serviceCache.Services);
                }
            }
            var services = await _serviceDiscovery.GetServicesAsync(name, version);

            var newCache = new ServiceCache(name, DateTime.Now.AddSeconds(_options.CacheRefreshInterval), services);

            _serviceCache.AddOrUpdate(name, newCache, (key, oldCache) => { return(newCache); });
            return(services);
        }
コード例 #23
0
        private async Task <ServiceCache> GetCache(string path)
        {
            ServiceCache result  = null;
            var          watcher = new NodeMonitorWatcher(_consul, _manager, path,
                                                          async(oldData, newData) => await NodeChange(oldData, newData));
            var queryResult = await _consul.KV.Keys(path);

            if (queryResult.Response != null)
            {
                var data = (await _consul.GetDataAsync(path));
                if (data != null)
                {
                    watcher.SetCurrentData(data);
                    result = await GetCache(data);
                }
            }
            return(result);
        }
コード例 #24
0
        private void SaveConfiguration(ServiceCache cache)
        {
            if (queue.Count > 0)
            {
                queue.Dequeue();
            }
            var setting = _cachingProvider.CachingSettings.Where(p => p.Id == cache.CacheDescriptor.Prefix)
                          .FirstOrDefault();

            if (setting != null)
            {
                setting.Properties.ForEach(p =>
                {
                    if (p.Maps != null)
                    {
                        p.Maps.ForEach(m =>
                        {
                            if (m.Name == cache.CacheDescriptor.Type)
                            {
                                m.Properties = cache.CacheEndpoint.Select(n =>
                                {
                                    var hashNode = n as ConsistentHashNode;
                                    if (!string.IsNullOrEmpty(hashNode.UserName) ||
                                        !string.IsNullOrEmpty(hashNode.Password))
                                    {
                                        return(new Property
                                        {
                                            Value =
                                                $"{hashNode.UserName}:{hashNode.Password}@{hashNode.Host}:{hashNode.Port}::{hashNode.Db}"
                                        });
                                    }

                                    return(new Property
                                    {
                                        Value = $"{hashNode.Host}:{hashNode.Port}::{hashNode.Db}"
                                    });
                                }).ToList();
                            }
                        });
                    }
                });
                queue.Enqueue(true);
            }
        }
コード例 #25
0
        private static Reviews Reviews(string customerId)
        {
            Assert.ValidInput(customerId, "customerId");

            if (ServiceCache.IsInCache <Reviews>(customerId))
            {
                var cachedReviews = (Reviews)ServiceCache.GetFromCache <Reviews>(customerId);
                if (cachedReviews != null)
                {
                    return(cachedReviews);
                }
            }

            var amazonResponse = new AmazonFactory(BuildRequest(customerId, null)).GetResponse();

            HandleErrors(amazonResponse.Errors);

            return(new Reviews(amazonResponse.Reviews.OrderByDescending(r => r.Date)).AddToCache(customerId));
        }
コード例 #26
0
        private static Wishlist Wishlist(string listId)
        {
            Assert.ValidInput(listId, "listId");

            if (ServiceCache.IsInCache <Wishlist>(listId))
            {
                var cachedWishlist = (Wishlist)ServiceCache.GetFromCache <Wishlist>(listId);
                if (cachedWishlist != null)
                {
                    return(cachedWishlist);
                }
            }

            var amazonResponse = new AmazonFactory(BuildRequest(null, listId)).GetResponse();

            HandleErrors(amazonResponse.Errors);

            return(new Wishlist(amazonResponse.Products.OrderBy(p => p.AuthorsMLA).ThenBy(p => p.Title)).AddToCache(listId));
        }
コード例 #27
0
        public async Task DelCacheEndpointAsync(string cacheId, string endpoint)
        {
            var model = await ServiceLocator.GetService <IServiceCacheManager>().GetAsync(cacheId);

            var cacheEndpoints = model.CacheEndpoint.Where(p => p.ToString() != endpoint).ToList();

            model.CacheEndpoint = cacheEndpoints;
            var caches      = new ServiceCache[] { model };
            var descriptors = caches.Where(cache => cache != null).Select(cache => new ServiceCacheDescriptor
            {
                AddressDescriptors = cache.CacheEndpoint?.Select(address => new CacheEndpointDescriptor
                {
                    Type  = address.GetType().FullName,
                    Value = _serializer.Serialize(address)
                }) ?? Enumerable.Empty <CacheEndpointDescriptor>(),
                CacheDescriptor = cache.CacheDescriptor
            });
            await ServiceLocator.GetService <IServiceCacheManager>().SetCachesAsync(descriptors);
        }
コード例 #28
0
        private async Task <ServiceCache> GetCache(string path)
        {
            ServiceCache result          = null;
            var          zooKeeperClient = await _zookeeperClientProvider.GetZooKeeperClient();

            if (zooKeeperClient == null)
            {
                return(result);
            }
            if (await zooKeeperClient.ExistsAsync(path))
            {
                var data    = (await zooKeeperClient.GetDataAsync(path)).ToArray();
                var watcher = nodeWatchers.GetOrAdd(path, f => new NodeMonitorWatcher(path, async(oldData, newData) => await NodeChange(oldData, newData)));
                await zooKeeperClient.SubscribeDataChange(path, watcher.HandleNodeDataChange);

                result = await GetCache(data);
            }
            return(result);
        }
コード例 #29
0
        public async Task ServiceHasCacheTest()
        {
            var cache = new ServiceCache();

            var service = new Management(MockData.ServiceNowUrl, MockData.Token, MockData.LimitSize, MockData.ServiceNowGetUserId, cache, mockClient);
            var result  = await service.CountKnowledge(MockData.KnowledgeTitle);

            Assert.AreEqual(result.Success, true);
            Assert.AreEqual(result.Knowledges.Length, MockData.KnowledgeCount);

            Assert.AreEqual(mockServiceNowRestClient.GetUserIdResponseCount, 1);

            service = new Management(MockData.ServiceNowUrl, MockData.Token, MockData.LimitSize, MockData.ServiceNowGetUserId, cache, mockClient);
            result  = await service.CountKnowledge(MockData.KnowledgeTitle);

            Assert.AreEqual(result.Success, true);
            Assert.AreEqual(result.Knowledges.Length, MockData.KnowledgeCount);

            Assert.AreEqual(mockServiceNowRestClient.GetUserIdResponseCount, 1);
        }
コード例 #30
0
        public Context(IFileSystem?fs = null)
        {
            Filesystem     = fs ?? Substitute.For <IFileSystem>();
            StoragePath    = Substitute.For <ICacheStoragePath>();
            ConfigProvider = Substitute.For <IConfigurationProvider>();
            JsonSettings   = new JsonSerializerSettings
            {
                Formatting       = Formatting.Indented,
                ContractResolver = new DefaultContractResolver
                {
                    NamingStrategy = new SnakeCaseNamingStrategy()
                }
            };

            // Set up a default for the active config's base URL. This is used to generate part of the path
            ConfigProvider.ActiveConfiguration = Substitute.For <IServiceConfiguration>();
            ConfigProvider.ActiveConfiguration.BaseUrl.Returns("http://localhost:1234");

            Cache = new ServiceCache(Filesystem, StoragePath, ConfigProvider, Substitute.For <ILogger>());
        }
コード例 #31
0
        public async Task TestCreateService()
        {
            using (CancellationTokenSource cancellationTokenSource = new CancellationTokenSource())
            {
                string domainName = "www.mywebsite.com";
                string ruleName = "mywebsite.com";
                string ruleUri = "www.mywebsite.com";
                string serviceOriginName = "example.com";
                string cacheRuleName = "default";
                string cacheRuleUri = "www.mywebsite.com";
                string restrictionRuleName = "mywebsite.com";
                string restrictionRuleReferrer = "www.mywebsite.com";
                string serviceRestrictionName = "website only";
                string serviceName = "testService";
                FlavorId flavorId = new FlavorId("cdn");


                cancellationTokenSource.CancelAfter(TestTimeout(TimeSpan.FromSeconds(10)));
                CancellationToken cancellationToken = cancellationTokenSource.Token;

                ServiceProtocol serviceProtocol = ServiceProtocol.Http;
                ServiceDomain sd = new ServiceDomain(domainName, serviceProtocol);
                ImmutableArray<ServiceDomain>.Builder sdbuilder = ImmutableArray.CreateBuilder<ServiceDomain>();
                sdbuilder.Add(sd);
                ImmutableArray<ServiceDomain> domains = sdbuilder.ToImmutable();

                ServiceOriginRule sor = new ServiceOriginRule(ruleName, ruleUri);
                ImmutableArray<ServiceOriginRule>.Builder sorbuilder = ImmutableArray.CreateBuilder<ServiceOriginRule>();
                sorbuilder.Add(sor);
                ImmutableArray<ServiceOriginRule> rules = sorbuilder.ToImmutable();


                ServiceOrigin so = new ServiceOrigin(serviceOriginName, 80, false, rules);
                ImmutableArray<ServiceOrigin>.Builder sobuilder = ImmutableArray.CreateBuilder<ServiceOrigin>();
                sobuilder.Add(so);
                ImmutableArray<ServiceOrigin> origins = sobuilder.ToImmutable();

            
                ServiceCacheRule scr = new ServiceCacheRule(cacheRuleName, cacheRuleUri);
                ImmutableArray<ServiceCacheRule>.Builder scrbuilder = ImmutableArray.CreateBuilder<ServiceCacheRule>();
                scrbuilder.Add(scr);
                ImmutableArray<ServiceCacheRule> scrules = scrbuilder.ToImmutable();


                ImmutableArray<ServiceCache>.Builder scbuilder = ImmutableArray.CreateBuilder<ServiceCache>();
                ServiceCache sc = new ServiceCache(cacheRuleName, new TimeSpan(0, 0, 3600), scrules);
                scbuilder.Add(sc);
                ImmutableArray<ServiceCache> caching = scbuilder.ToImmutable();
                caching = new ImmutableArray<ServiceCache>();



                ImmutableArray<ServiceRestrictionRule>.Builder srrbuilder = ImmutableArray.CreateBuilder<ServiceRestrictionRule>();
                ServiceRestrictionRule srr = new ServiceRestrictionRule(restrictionRuleName, restrictionRuleReferrer);
                srrbuilder.Add(srr);
                ImmutableArray<ServiceRestrictionRule> srrules = srrbuilder.ToImmutable();
                srrules = new ImmutableArray<ServiceRestrictionRule>();



                ImmutableArray<ServiceRestriction>.Builder rbuilder = ImmutableArray.CreateBuilder<ServiceRestriction>();
                ServiceRestriction sr = new ServiceRestriction(serviceRestrictionName, srrules);
                rbuilder.Add(sr);
                ImmutableArray<ServiceRestriction> restrictions = rbuilder.ToImmutable();
                restrictions = new ImmutableArray<ServiceRestriction>();


                ServiceData serviceData = new ServiceData(serviceName, flavorId, domains, origins, caching, restrictions);
//
                //ServiceData sed = new ServiceData(serviceName, flavorId, domains, origins, caching, restrictions);
                //CancellationToken cn = new CancellationToken();
                //ServiceId x = await cdc.AddServiceAsync(serviceData, cn);
//

                IContentDeliveryService service = CreateService();
                using (AddServiceApiCall apiCall = await service.PrepareAddServiceAsync(serviceData, cancellationToken))
                {
                    Tuple<HttpResponseMessage, ServiceId> response = await apiCall.SendAsync(cancellationToken);
                    Assert.IsNotNull(response);

                    var responseMessage = response.Item1;
                    Assert.IsNotNull(responseMessage);
                    Assert.AreEqual(HttpStatusCode.OK, responseMessage.StatusCode);

                    ServiceId serviceID = response.Item2;
                    Assert.IsNotNull(serviceID);
                }


                using (GetHomeApiCall apiCall = await service.PrepareGetHomeAsync(cancellationToken))
                {
                    Tuple<HttpResponseMessage, HomeDocument> response = await apiCall.SendAsync(cancellationToken);
                    Assert.IsNotNull(response);

                    var responseMessage = response.Item1;
                    Assert.IsNotNull(responseMessage);
                    Assert.AreEqual(HttpStatusCode.OK, responseMessage.StatusCode);

                    HomeDocument homeDocument = response.Item2;
                    CheckHomeDocument(homeDocument);
                }
            }
        }