public static void TestGmQueueWithStructSix()
        {
            MwsrThreadQueue msgQueue = new MwsrThreadQueue(5);
            MetaPool        mp       = initializeGmQueue(msgQueue);

            mtest.StructSix_publisher publ = new mtest.StructSix_publisher();

            mtest.StructSix data = test_publishable_six.GetPublishableSix();
            publ.debugOnlySetData(data);

            mp.add(publ);

            string path = getSubscriptionAddress("StructSix");

            mtest.StructSix_subscriber subs1 = new mtest.StructSix_subscriber();

            Assert.False(publ.isEquivalent(subs1));

            mp.add(subs1);
            mp.subscribe(subs1, path);

            int msgCnt = 0;

            mp.postAllUpdates();
            deliverAllMessages(mp, msgQueue, null, ref msgCnt);

            Assert.True(publ.isEquivalent(subs1));

            mtest.StructSix_subscriber subs2 = new mtest.StructSix_subscriber();
            //mtest.StructSix data2 = (mtest.StructSix)subs2.debugOnlyGetData();

            mp.add(subs2);
            mp.subscribe(subs2, path);

            mtest.StructSix_subscriber subs3 = new mtest.StructSix_subscriber();
            //mtest.StructSix data3 = (mtest.StructSix)subs3.debugOnlyGetData();

            mp.add(subs3);
            mp.subscribe(subs3, path);

            mp.postAllUpdates();
            deliverAllMessages(mp, msgQueue, null, ref msgCnt);

            Assert.True(publ.isEquivalent(subs2));
            Assert.True(publ.isEquivalent(subs3));

            test_publishable_six.doUpdate1(publ);

            Assert.False(publ.isEquivalent(subs1));
            Assert.False(publ.isEquivalent(subs2));
            Assert.False(publ.isEquivalent(subs3));

            mp.postAllUpdates();
            deliverAllMessages(mp, msgQueue, null, ref msgCnt);

            Assert.True(publ.isEquivalent(subs1));
            Assert.True(publ.isEquivalent(subs2));
            Assert.True(publ.isEquivalent(subs3));
        }
Ejemplo n.º 2
0
        internal static void TestComposeStateSync(ITestPlatformSupport platform, String fileName)
        {
            mtest.StructSix_publisher publ = new  mtest.StructSix_publisher();
            mtest.StructSix           data = GetPublishableSix();
            publ.debugOnlySetData(data);

            SimpleBuffer         buffer   = new SimpleBuffer();
            IPublishableComposer composer = platform.makePublishableComposer(buffer);

            publ.generateStateSyncMessage(composer);

            if (WriteFiles)
            {
                buffer.writeToFile(fileName);
            }

            SimpleBuffer expected = SimpleBuffer.readFromFile(fileName);

            Assert.True(platform.AreEqual(expected, buffer));
        }
Ejemplo n.º 3
0
        internal static void TestComposeUpdate(ITestPlatformSupport platform, String fileName, Action <mtest.IStructSix> updateDelegate)
        {
            mtest.StructSix_publisher publ = new mtest.StructSix_publisher();
            mtest.StructSix           data = GetPublishableSix();
            publ.debugOnlySetData(data);

            SimpleBuffer         buffer   = new SimpleBuffer();
            IPublishableComposer composer = platform.makePublishableComposer(buffer);

            publ.startTick(composer);

            updateDelegate(publ);

            publ.endTick();

            if (WriteFiles)
            {
                buffer.writeToFile(fileName);
            }

            SimpleBuffer expected = SimpleBuffer.readFromFile(fileName);

            Assert.True(platform.AreEqual(expected, buffer));
        }