コード例 #1
0
        private static int SendParallel(Connection c)
        {
            int counter = 0;
            List<GetE2PromExt> td = TestData().ToList();
            foreach (var data in td)
            {
                c.EnQueue(data);
                Console.WriteLine(data.ModuleName + "send");
            }
            foreach (var dispatchData in td)
            {
                dispatchData.WaitAsync().Wait();
                Assert.IsTrue(dispatchData.ModuleDataCheckOk, "data received incorrect");
                counter++;
            }

            return counter;
        }
コード例 #2
0
 private static int SendSequential(Connection c)
 {
     var counter = 0;
     foreach (var data in TestData())
     {
         c.EnQueue(data);
         data.WaitAsync().Wait();
         Assert.IsTrue(data.ModuleDataCheckOk, "data received incorrect");
         Console.WriteLine(data.ModuleName + "send");
         counter++;
     }
     return counter;
 }
コード例 #3
0
        public void MessageSelectionTest()
        {
            var z = new List<MessageSelectModel>(Enumerable.Range(0, 3).Select(n => new MessageSelectModel()));

            z[0].ButtonA1 = 0;
            z[0].ButtonA2 = 1;

            z[0].ButtonB1 = 2;
            z[0].ButtonB2 = 3;

            z[0].ButtonC1 = 4;
            z[0].ButtonC2 = 5;

            z[0].ButtonD1 = 6;
            z[0].ButtonD2 = 7;

            z[1].ButtonC1 = 255;
            z[1].ButtonC2 = 254;
            //            z[1].ButtonD1 = 253; //==no message;
            z[1].ButtonD2 = 252;

            z[2].ButtonB2 = 3;
            z[2].ButtonC1 = 0;

            int a = 4;

            var sendPacket = new SetMessageSelection(z, a, a, a, a, 250, 255, 0);
            var receivePacket = new GetMessageSelection(0);

            var connection = new Connection();
            var modeChanged = new AutoResetEvent(false);

            CreateConnection(connection, modeChanged);

            connection.EnQueue(sendPacket);
            sendPacket.WaitAsync().Wait();

            connection.EnQueue(receivePacket);
            receivePacket.WaitAsync().Wait();

            DisConnection(connection, modeChanged);

            Assert.AreEqual(a, receivePacket.PreannounceEP);
            Assert.AreEqual(255, receivePacket.PreannounceExtAudio);
            Assert.AreEqual(250, receivePacket.PreannounceFDS);
            Assert.AreEqual(a, receivePacket.PreannounceFP);

            Assert.AreEqual(a, receivePacket.AlarmTrack);
            Assert.AreEqual(a, receivePacket.AlertTrack);

            for (int i = 0; i < 3; i++)
            {
                Assert.AreEqual(z[i], receivePacket.MessageSelectModels[i]);
            }
        }