Пример #1
0
        private static async Task RunClientTestsSetup(IClusterClient client)
        {
            int numWarehouses = 2;
            int numProducts   = 100;
            int numOrders     = 100;

            var warehouses = await Test_Warehouses.GetAll(client);

            for (int n = warehouses.Length; n < numWarehouses; n++)
            {
                var name = (n + 1).ToString("000");
                await Test_Warehouses.Add(client, name);
            }

            var products = await Test_Products.GetAll(client);

            if (products.Length < numProducts)
            {
                await Test_Products.AddBatch(client, numProducts - products.Length, 100);
            }

            products = await Test_Products.GetAll(client);

            var totMsExists  = 0d;
            var totMsCreated = 0d;

            for (int n = 0; n < 10; n++)
            {
                totMsExists += await Test_Products.ExistsBatch(client, numProducts, 100, products);

                totMsCreated += await Test_Products.CreatedBatch(client, numProducts, 100, products);
            }
            Console.WriteLine($"Check for exists for products - Time elapsed: {totMsExists} ms - {(products.Length == 0 ? 0 : totMsExists / products.Length)} for product");
            Console.WriteLine($"Check for created for products - Time elapsed: {totMsCreated} ms - {(products.Length == 0 ? 0 : totMsCreated / products.Length)} for product");

            if (products.Length < numProducts)
            {
                var x = "wait for streaming";
            }

            await Test_Orders.GetOrdersStatsCache(client);

            var orders = await Test_Orders.GetAll(client);

            if (orders.Length < numOrders)
            {
                await Test_Orders.AddBatch(client, numOrders - orders.Length, 100);

                await StartReminders(client);

                await Test_Orders.WaitForAllDispatched(client);
            }

            await Test_Orders.GetOrdersStatsCache(client);
        }
        private static async Task RunClientTestsSetup(IClusterClient client)
        {
            int numWarehouses = 2;
            int numProducts   = 100;
            int numOrders     = 100;

            var warehouses = await Test_Warehouses.GetAll(client);

            for (int n = warehouses.Length; n < numWarehouses; n++)
            {
                var name = (n + 1).ToString("000");
                await Test_Warehouses.Add(client, name);
            }

            var products = await Test_Products.GetAll(client);

            if (products.Length < numProducts)
            {
                await Test_Products.AddBatch(client, numProducts - products.Length, 100);
            }

            products = await Test_Products.GetAll(client);

            if (products.Length < numProducts)
            {
                var x = "wait for streaming";
            }

            await Test_Orders.GetOrdersStatsCache(client);

            // await Test_Orders.WaitForAllDispatched(client);
            var orders = await Test_Orders.GetAll(client);

            if (orders.Length < numOrders)
            {
                await Test_Orders.AddBatch(client, numOrders - orders.Length, 100);

                await StartReminders(client);

                await Test_Orders.WaitForAllDispatched(client);
            }

            await Test_Orders.GetOrdersStatsCache(client);
        }