public static void Main(string[] args) { // Create random inputs Random numGen = new Random(); double x = numGen.NextDouble() * 20; double y = numGen.NextDouble() * 20; var serviceAddress = "http://localhost:5000/CalculatorService.svc"; var client = new CalculatorServiceClient(new BasicHttpBinding(), new EndpointAddress(serviceAddress)); Console.WriteLine($"{x} + {y} == {client.Add(x, y)}"); Console.WriteLine($"{x} - {y} == {client.Subtract(x, y)}"); Console.WriteLine($"{x} * {y} == {client.Multiply(x, y)}"); Console.WriteLine($"{x} / {y} == {client.Divide(x, y)}"); }
public static void Main(string[] args) { if (args.Length < 1) { Console.WriteLine("Please provide the remote URL of the calculator service"); return; } // Create random inputs Random numGen = new Random(); double x = numGen.NextDouble() * 20; double y = numGen.NextDouble() * 20; var serviceAddress = $"{args[0]}/CalculatorService.svc"; var client = new CalculatorServiceClient(new BasicHttpBinding(), new EndpointAddress(serviceAddress)); Console.WriteLine($"{x} + {y} == {client.Add(x, y)}"); Console.WriteLine($"{x} - {y} == {client.Subtract(x, y)}"); Console.WriteLine($"{x} * {y} == {client.Multiply(x, y)}"); Console.WriteLine($"{x} / {y} == {client.Divide(x, y)}"); }