Beispiel #1
0
        public Test()
        {
            TestOp testOp = new TestOp
            {
                Value = 5
            };
            OperationProcessor operationProcessor  = testOp.RequestProcessor();
            OperationProcessor operationProcessor2 = new TestOpProcessor(7, testOp);
            Queue <object>     reqq  = new Queue <object>();
            Queue <object>     procq = new Queue <object>();

            operationProcessor.OnSend += delegate(object msg)
            {
                procq.Enqueue(msg);
            };
            operationProcessor2.OnSend += delegate(object msg)
            {
                reqq.Enqueue(msg);
            };
            operationProcessor.Start();
            operationProcessor2.Start();
            do
            {
                if (reqq.Count > 0)
                {
                    operationProcessor.ProcessFeedback(reqq.Dequeue());
                }
                if (procq.Count > 0)
                {
                    operationProcessor2.ProcessFeedback(procq.Dequeue());
                }
            }while (!operationProcessor2.Finished || !operationProcessor.Finished);
        }
Beispiel #2
0
        public void Setup()
        {
            _processor = new OperationProcessor();
            _processor.LoggingService = new Mock <ILoggingService>().Object;
            var schedule = new Mock <ISchedule>();

            _processor.Start(schedule.Object);
            var operationScheduleMock = new Mock <OperationScheduleBase>();
            var propertiesMock        = new OperationProperties(operationScheduleMock.Object);
            var protocolMock          = new Mock <IProtocol>();
            var operationMock         = new Operation(protocolMock.Object, propertiesMock, 1); //TODO: Operation is dependent of protocol - wrong architecture

            _operation = operationMock;
        }