コード例 #1
0
        public async Task PostServerNodeAsyncTest()
        {
            var node         = new ServerNode();
            var nodeReturned = await client.CreateServerNodeAsync(node);

            Assert.IsTrue(node.Name == nodeReturned.Name);
            Assert.IsTrue(node.ServerId == nodeReturned.ServerId);
            Assert.IsTrue(node.UriHashRange == nodeReturned.UriHashRange);
            Assert.IsTrue(node.Created == nodeReturned.Created);
            Assert.IsTrue(node.IsApproved == nodeReturned.IsApproved);
        }
コード例 #2
0
        static async Task GetOrCreateServerNode(FetchoConfiguration cfg)
        {
            if (cfg.FetchoWorkspaceServerBaseUri.Length == 0)
            {
                return;
            }

            var fetchoClient = new FetchoAPIV1Client(new Uri(cfg.FetchoWorkspaceServerBaseUri));

            cfg.CurrentServerNode = await fetchoClient.GetServerNodeAsync(Environment.MachineName);

            if (cfg.CurrentServerNode == null)
            {
                cfg.CurrentServerNode = await fetchoClient.CreateServerNodeAsync(new ServerNode());
            }
        }