Exemple #1
0
        static void TestParseUpdate(TestCommon.Protocol proto, String fileNameInit, String fileName, Func <mtest.publishable_dictionary> getState, Action <mtest.Ipublishable_dictionary> updateDelegate)
        {
            mtest.publishable_dictionary_subscriber subs = new mtest.publishable_dictionary_subscriber();
            //mtest.publishable_dictionary data = getState();
            //subs.debugOnlySetData(data);
            SimpleBuffer       bufferInit = SimpleBuffer.readFromFile(fileNameInit);
            IPublishableParser parserInit = TestCommon.makePublishableParser(proto, bufferInit.getReadIterator());

            subs.applyStateSyncMessage(parserInit);

            mtest.publishable_dictionary expected = getState();
            Assert.True(expected.isEquivalent(subs));

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

            subs.applyMessageWithUpdates(parser);


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

            updateDelegate(expected);

            Assert.True(expected.isEquivalent(subs));
        }
        static void TestParseStateSync(Protocol proto, String fileName, Func <mtest.publishable_dictionary> getState)
        {
            mtest.publishable_dictionary_subscriber subs = new mtest.publishable_dictionary_subscriber();

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

            subs.applyStateSyncMessage(parser);

            mtest.publishable_dictionary expected = getState();

            Assert.True(expected.isEquivalent(subs));
        }