コード例 #1
0
        public async void CreateForService2()
        {
            using var star = new StarFactory("http://127.0.0.1:6600", "test", "xxx");

            var client = star.CreateForService("StarWeb", "tagB") as ApiHttpClient;

            Assert.NotNull(client);
            Assert.True(client.RoundRobin);
            Assert.Equal(0, client.Services.Count);

            var client2 = star.CreateForService("StarWeb", "Development") as ApiHttpClient;

            Assert.NotNull(client2);
            Assert.True(client2.RoundRobin);
            Assert.Equal("https://localhost:5001/,http://localhost:5000/", client2.Services.Join(",", e => e.Address));
        }
コード例 #2
0
        public async void CreateForService()
        {
            using var star = new StarFactory("http://127.0.0.1:6600", "test", "xxx");
            await star.Service.RegisterAsync("testService", "http://localhost:1234", "tA,tagB,ttC");

            var client = star.CreateForService("testService", "tagB") as ApiHttpClient;

            Assert.NotNull(client);
            Assert.True(client.RoundRobin);
            Assert.Equal("http://localhost:1234/", client.Services.Join(",", e => e.Address));
        }