static void TestComposeUpdate(Protocol proto, String fileName, Func <mtest.publishable_dunion> getState, Action <mtest.Ipublishable_dunion> updateDelegate)
        {
            mtest.publishable_dunion_publisher publ = new mtest.publishable_dunion_publisher();
            mtest.publishable_dunion           data = getState();
            publ.debugOnlySetData(data);

            SimpleBuffer         buffer   = new SimpleBuffer();
            IPublishableComposer composer = makePublishableComposer(proto, buffer);

            publ.startTick(composer);

            updateDelegate(publ);

            publ.endTick();

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

            SimpleBuffer expected = SimpleBuffer.readFromFile(fileName);

            if (proto == Protocol.Json)
            {
                Assert.True(SimpleBuffer.AreEqualIgnoreEol(expected, buffer));
            }
            else if (proto == Protocol.Gmq)
            {
                Assert.AreEqual(expected, buffer);
            }
        }
        static void TestComposeStateSync(Protocol proto, String fileName, Func <mtest.publishable_dunion> getState)
        {
            mtest.publishable_dunion_publisher publ = new mtest.publishable_dunion_publisher();
            mtest.publishable_dunion           data = getState();
            publ.debugOnlySetData(data);

            SimpleBuffer         buffer   = new SimpleBuffer();
            IPublishableComposer composer = makePublishableComposer(proto, buffer);

            publ.generateStateSyncMessage(composer);

            // uncomment to update file
            if (WriteFiles)
            {
                buffer.writeToFile(fileName);
            }

            SimpleBuffer expected = SimpleBuffer.readFromFile(fileName);

            if (proto == Protocol.Json)
            {
                Assert.True(SimpleBuffer.AreEqualIgnoreEol(expected, buffer));
            }
            else if (proto == Protocol.Gmq)
            {
                Assert.AreEqual(expected, buffer);
            }
        }
        public static mtest.publishable_dunion GetPublishableUnion_0()
        {
            mtest.publishable_dunion data = new mtest.publishable_dunion();

            data.name = "dunion";

            return(data);
        }
        static void TestParseStateSync(Protocol proto, String fileName, Func <mtest.publishable_dunion> getState)
        {
            mtest.publishable_dunion_subscriber subs = new mtest.publishable_dunion_subscriber();

            SimpleBuffer       buffer = SimpleBuffer.readFromFile(fileName);
            IPublishableParser parser = makePublishableParser(proto, buffer.getReadIterator());

            subs.applyStateSyncMessage(parser);

            mtest.publishable_dunion expected = getState();

            Assert.True(expected.isEquivalent(subs));
        }
        static void TestParseUpdate(Protocol proto, String fileNameInit, String fileName, Func <mtest.publishable_dunion> getState, Action <mtest.Ipublishable_dunion> updateDelegate)
        {
            mtest.publishable_dunion_subscriber subs = new mtest.publishable_dunion_subscriber();
            //mtest.publishable_dunion data = getState();
            //subs.debugOnlySetData(data);
            SimpleBuffer       bufferInit = SimpleBuffer.readFromFile(fileNameInit);
            IPublishableParser parserInit = makePublishableParser(proto, bufferInit.getReadIterator());

            subs.applyStateSyncMessage(parserInit);


            SimpleBuffer       buffer = SimpleBuffer.readFromFile(fileName);
            IPublishableParser parser = makePublishableParser(proto, buffer.getReadIterator());

            subs.applyMessageWithUpdates(parser);

            mtest.publishable_dunion expected = getState();

            Assert.False(expected.isEquivalent(subs));

            updateDelegate(expected);

            Assert.True(expected.isEquivalent(subs));
        }
 public static mtest.publishable_dunion GetPublishableUnion_2()
 {
     mtest.publishable_dunion data = new mtest.publishable_dunion();
     doUpdate2(data);
     return(data);
 }