コード例 #1
0
        public async Task TestClientSendsComputeJobToDefaultNodeWhenDirectConnectionToTargetDoesNotExist()
        {
            using var server1 = new FakeServer(nodeName: "s1");
            using var server2 = new FakeServer(nodeName: "s2");
            using var server3 = new FakeServer(nodeName: "s3");

            using var client = await server1.ConnectClientAsync();

            var res2 = await client.Compute.ExecuteAsync <string>(nodes : new[] { server2.Node }, jobClassName : string.Empty);

            var res3 = await client.Compute.ExecuteAsync <string>(nodes : new[] { server3.Node }, jobClassName : string.Empty);

            Assert.AreEqual("s1", res2);
            Assert.AreEqual("s1", res3);
            Assert.AreEqual(new[] { ClientOp.ComputeExecute, ClientOp.ComputeExecute }, server1.ClientOps);

            Assert.IsEmpty(server2.ClientOps);
            Assert.IsEmpty(server3.ClientOps);

            Assert.AreEqual(server1.Node, client.GetConnections().Single());
        }