internal async Task RunClientAsync() { var clientSock = new TcpClient(); _barrier.SignalAndWait(); await clientSock.ConnectAsync(IPAddress.Loopback, Program.lbPort); var caller = new RpcCaller <IHelloService>( new NetworkRpcClient(new TcpTransportLayer(clientSock) )); //var result = await caller.CallByNameAsync<string>(nameof(IHelloServer.SayHello)); _barrier.SignalAndWait(); var client = caller.CreateClient(); var helloResult = client.SayHello(); Console.WriteLine($"Sent command from client. Server responded {helloResult}"); Console.WriteLine($"Is the sky blue?: {client.IsSkyBlue()}"); Console.WriteLine($"1 + 3 is: {client.Add(1, 3)}"); var c1 = new TastyCookie(TastyCookie.CookieFlavor.Chocolate, 6, 1); var c2 = new TastyCookie(TastyCookie.CookieFlavor.Chocolate, 8, 1.2); Console.WriteLine($"Volume of TastyCookie 1 is: {client.GetVolume(c1)}"); Console.WriteLine($"Cookie {(client.Compare(c1, c2) ? "1" : "2")} is larger."); await Task.Delay(0); }
public void CanCallMultipleSimpleObjects() { var c1 = new TastyCookie(TastyCookie.CookieFlavor.Chocolate, 6, 1); var c2 = new TastyCookie(TastyCookie.CookieFlavor.Chocolate, 8, 1.2); Assert.Equal(_fixture.Client.Compare(c1, c2), false); }
public void CanCallSimpleObjects() { var c1 = new TastyCookie(TastyCookie.CookieFlavor.Chocolate, 6, 1); var vol = Math.PI * c1.Radius * c1.Radius * c1.Thickness; Assert.Equal(_fixture.Client.GetVolume(c1), vol); }
public bool Compare(TastyCookie c1, TastyCookie c2) { return(GetVolume(c1) >= GetVolume(c2)); }
public double GetVolume(TastyCookie cookie) { return(Math.Pow(cookie.Radius, 2) * Math.PI * cookie.Thickness); }