static void TestComposeStateSync(Protocol proto, String fileName, Func <mtest.publishable_dictionary> getState) { mtest.publishable_dictionary_publisher publ = new mtest.publishable_dictionary_publisher(); mtest.publishable_dictionary 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); } }
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 TestComposeUpdate(TestCommon.Protocol proto, String fileName, Func <mtest.publishable_dictionary> getState, Action <mtest.Ipublishable_dictionary> updateDelegate) { mtest.publishable_dictionary_publisher publ = new mtest.publishable_dictionary_publisher(); mtest.publishable_dictionary data = getState(); publ.debugOnlySetData(data); SimpleBuffer buffer = new SimpleBuffer(); IPublishableComposer composer = TestCommon.makePublishableComposer(proto, buffer); publ.startTick(composer); updateDelegate(publ); publ.endTick(); if (WriteFiles) { buffer.writeToFile(fileName); } SimpleBuffer expected = SimpleBuffer.readFromFile(fileName); if (proto == TestCommon.Protocol.Json) { Assert.True(SimpleBuffer.AreEqualIgnoreEol(expected, buffer)); } else if (proto == TestCommon.Protocol.Gmq) { Assert.AreEqual(expected, buffer); } }
public static mtest.publishable_dictionary GetPublishableDictionary_0() { mtest.publishable_dictionary data = new mtest.publishable_dictionary(); data.name = "dictionary"; return(data); }
static mtest.publishable_dictionary GetPublishableDictionary_2() { mtest.publishable_dictionary pub = new mtest.publishable_dictionary(); pub.name = "publishable_dictionary"; pub.data = test_struct_dictionary.GetDictionary_2(); return(pub); }
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)); }
static void TestComposeUpdate(Protocol proto, String fileName, Func <mtest.publishable_dictionary> getState, Action <mtest.Ipublishable_dictionary> updateDelegate) { mtest.publishable_dictionary_publisher publ = new mtest.publishable_dictionary_publisher(); mtest.publishable_dictionary 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); } Assert.AreEqual(buffer, SimpleBuffer.readFromFile(fileName)); }
public static mtest.publishable_dictionary GetPublishableDictionary_1() { mtest.publishable_dictionary data = GetPublishableDictionary_0(); doUpdate1(data); return(data); }