예제 #1
0
        public void Test2()
        {
            var testClientManager = new TestClientManager();
            var qwer = "qwer";
            var uiop = "uiop";

            testClientManager.AddClient(new TestHost(qwer), new TestClient(qwer));
            testClientManager.AddClient(new TestHost(uiop), new TestClient(uiop));
            var wlm  = new WorkloadManager();
            var yolo = wlm.MulticastAsync(new TestAbstractRequestInstructions(new TestRequest(new TestHost("requestASDF")), TimeSpan.FromMilliseconds(10000),
                                                                              TestResponseTransformer, Guid.NewGuid(), testClientManager), new List <IHost> {
                new TestHost(qwer), new TestHost(uiop)
            },
                                          new AscendingSortAggregator <string>()).Result;

            Assert.Equal(yolo.Count, 2);
            Assert.True(yolo.Contains($"{typeof(TestHost).FullName}_sklfjlksdjklflksdkflsldf_{uiop}_ResponseTransformed"));
            Assert.True(yolo.Contains($"{typeof(TestHost).FullName}_sklfjlksdjklflksdkflsldf_{qwer}_ResponseTransformed"));
        }
예제 #2
0
        public void Test1()
        {
            var main          = new WorkloadManager();
            var clientManager = new HttpClientManager();

            clientManager.AddClient(new HttpHost(_client.BaseAddress.AbsoluteUri), new SgHttpClient(_client));
            var result = main.MulticastAsync(
                new HttpRequestInstructions <string>(new HttpRequestMessageWrapper(), TimeSpan.FromSeconds(30),
                                                     ResponseTransformer, Guid.NewGuid()),
                new List <IHost>()
            {
                new HttpHost("http://localhost:1111"),
                new HttpHost("http://localhost:51073"),
                new HttpHost("http://localhost:51073"),
                new HttpHost("http://localhost:1111"),
            }, new AscendingSortAggregator <string>()).Result;

            Assert.Equal(2, result.Count);
            Assert.True(result.All(x => x == "All is well"));
        }