Пример #1
0
        public void WorkId2BaseTest()
        {
            var helper = new UnitTestHelper(Amount, 1, 3);
            var values = helper.PrepareData <int>();

            var distributor = new Distributor();

            distributor.AddWorkerCell(new IntToEntityWorker());
            distributor.AddWorkerCell(new StringToEntityWorker());
            distributor.AddWorkerCell(new EntityToEntityWorker());
            distributor.AddWorkerCell(new EntityToModelWorker());

            distributor.Start();

            distributor.AddData(values, new ModelConsumer(helper.SetResult), 2);
            distributor.AddData(values, new ModelConsumer(helper.SetResult), 2);
            distributor.AddData(values, new ModelConsumer(helper.SetResult), 2);

            helper.AwaitTest();
            distributor.Stop();

            PrintTestResults(helper.Results);

            Assert.Equal(helper.ResultAmount(), helper.Results.Count);
        }
Пример #2
0
        private void GenerateAndInject()
        {
            Console.WriteLine($"Injector starting pushing data at:{DateTime.Now}");

            var amount = GenerateRandomNumber(1, 100);
            var values = new List <string>();

            for (var i = 0; i <= amount; i++)
            {
                for (var ii = 0; ii < GenerateRandomNumber(1, 100); ii++)
                {
                    values.Add(RandomString(GenerateRandomNumber(0, 300000)));
                }
            }

            _dis.AddData(values, new Consumer(), 1);

            Console.WriteLine($"Injector done pushing[{amount}] data at:{DateTime.Now}");
        }