Beispiel #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);
        }
Beispiel #2
0
        private static void Main(string[] args)
        {
            var dis = new Distributor(20, 20, Distributor.MegaBytes.OneGB);

            dis.AddWorkerCell(new TimeWorker());
            dis.AddWorkerCell(new OutputWorker());

            var injector = new Injector(dis);

            injector.Start();

            Console.ReadKey();
        }