static void TestParseStateSync(ITestPlatformSupport platform, String fileName) { mtest.publishable_seven_subscriber subs = new mtest.publishable_seven_subscriber(); SimpleBuffer buffer = SimpleBuffer.readFromFile(fileName); IPublishableParser parser = platform.makePublishableParser(buffer.getReadIterator()); subs.applyStateSyncMessage(parser); //mtest.publishable_seven actual = (mtest.publishable_seven)subs.debugOnlyGetData(); mtest.publishable_seven expected = GetPublishableSeven(); Assert.True(expected.isEquivalent(subs)); }
static void TestParseUpdate(ITestPlatformSupport platform, String fileNameInit, String fileName, Action <mtest.Ipublishable_seven> updateDelegate) { mtest.publishable_seven_subscriber subs = new mtest.publishable_seven_subscriber(); //subs.debugOnlySetData(GetPublishableSeven()); SimpleBuffer bufferInit = SimpleBuffer.readFromFile(fileNameInit); IPublishableParser parserInit = platform.makePublishableParser(bufferInit.getReadIterator()); subs.applyStateSyncMessage(parserInit); SimpleBuffer buffer = SimpleBuffer.readFromFile(fileName); IPublishableParser parser = platform.makePublishableParser(buffer.getReadIterator()); subs.applyMessageWithUpdates(parser); //mtest.publishable_seven actual = (mtest.publishable_seven)subs.debugOnlyGetData(); mtest.publishable_seven expected = GetPublishableSeven(); Assert.False(expected.isEquivalent(subs)); updateDelegate(expected); Assert.True(expected.isEquivalent(subs)); }
static void TestJsonParseUpdate(String fileInitial, String fileUpdate, Events[] events) { List <Events> handled = new List <Events>(); publishable_seven_stub stub = new publishable_seven_stub(handled); SimpleBuffer bufferInitial = SimpleBuffer.readFromFile(fileInitial); JsonPublishableParser parserInitial = new JsonPublishableParser(bufferInitial.getReadIterator()); stub.applyStateSyncMessage(parserInitial); mtest.publishable_seven expected = test_publishable_seven.GetPublishableSeven(); Assert.True(expected.isEquivalent(stub)); if (fileUpdate != null) { SimpleBuffer bufferUpdate = SimpleBuffer.readFromFile(fileUpdate); JsonPublishableParser parserUpdate = new JsonPublishableParser(bufferUpdate.getReadIterator()); stub.applyMessageWithUpdates(parserUpdate); } Assert.AreEqual(events, handled.ToArray()); }