public static void Generate(string[] args)
        {
            if (args.Length != 3)
            {
                throw new ArgumentException("Expected 3 arguments", nameof(args));
            }

            var serviceUrl    = args[1];
            var numberOfGames = int.Parse(args[2]);

            Console.WriteLine($"serviceUrl: {serviceUrl}");
            Console.WriteLine($"numberOfGames: {numberOfGames}");

            using (var svc = new CommandServiceProxy())
            {
                svc.SetUrl(serviceUrl);

                foreach (var cmd in GenerateSampleDataCommands(numberOfGames))
                {
                    Console.WriteLine($"Executing Command: {cmd.GetType().Name}");
                    try
                    {
                        svc.ExecuteCommand(cmd);
                    }
                    catch (AggregateException ex)
                    {
                        foreach (var x in ex.InnerExceptions)
                        {
                            Console.WriteLine(x.ToString());
                            Console.WriteLine($"Agg Inner: {x.InnerException?.ToString()}");
                        }

                        throw;
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.ToString());
                        Console.WriteLine($"Inner: {ex.InnerException?.ToString()}");
                        throw;
                    }
                }
            }
        }
Пример #2
0
        public static void Generate(string[] args)
        {
            if (args.Length != 3)
            {
                throw new ArgumentException("Expected 3 arguments", "args");
            }

            var serviceUrl    = args[1];
            var numberOfGames = int.Parse(args[2]);

            Console.WriteLine($"serviceUrl: {serviceUrl}");
            Console.WriteLine($"numberOfGames: {numberOfGames}");

            using (var svc = new CommandServiceProxy())
            {
                svc.SetUrl(serviceUrl);

                foreach (var cmd in GenerateSampleDataCommands(numberOfGames))
                {
                    Console.WriteLine($"Executing Command: {cmd.GetType().Name}");
                    svc.ExecuteCommand(cmd);
                }
            }
        }