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);
            }
        }