static mtest.SimpleStruct GetSample1() { mtest.SimpleStruct msg = new mtest.SimpleStruct(); msg.name = "Hello world!"; msg.id = 1; return(msg); }
public static void TestGmqParse() { SimpleBuffer buffer = SimpleBuffer.readFromFile(PathGmq); GmqParser parser = new GmqParser(buffer.getReadIterator()); mtest.SimpleStruct msg = new mtest.SimpleStruct(); mtest.SimpleStruct_message.parse(parser, msg); Assert.True(GetSample1().isEquivalent(msg)); }
public static void TestGmqCompose() { mtest.SimpleStruct data = GetSample1(); SimpleBuffer buffer = new SimpleBuffer(); GmqComposer composer = new GmqComposer(buffer); mtest.SimpleStruct_message.compose(composer, data); // uncomment to update file //buffer.writeToFile(PathGmq); Assert.AreEqual(buffer, SimpleBuffer.readFromFile(PathGmq)); }
public static void TestJsonCompose() { mtest.SimpleStruct data = GetSample1(); SimpleBuffer buffer = new SimpleBuffer(); JsonComposer composer = new JsonComposer(buffer); mtest.SimpleStruct_message.compose(composer, data); // uncomment to update file //buffer.writeToFile(PathJson); SimpleBuffer expected = SimpleBuffer.readFromFile(PathJson); Assert.True(SimpleBuffer.AreEqualIgnoreEol(expected, buffer)); }