static void TestGmqParse(Func <mtest.struct_dictionary> sampleData, string fileName) { SimpleBuffer buffer = SimpleBuffer.readFromFile(fileName); GmqParser parser = new GmqParser(buffer.getReadIterator()); mtest.struct_dictionary msg = new mtest.struct_dictionary(); mtest.struct_dictionary_message.parse(parser, msg); Assert.AreEqual(sampleData(), msg); }
static void TestJsonCompose(Func <mtest.struct_dictionary> sampleData, string fileName) { mtest.struct_dictionary msg = sampleData(); SimpleBuffer buffer = new SimpleBuffer(); JsonComposer composer = new JsonComposer(buffer); mtest.struct_dictionary_message.compose(composer, msg); if (WriteFiles) { buffer.writeToFile(fileName); } SimpleBuffer expected = SimpleBuffer.readFromFile(fileName); Assert.True(SimpleBuffer.AreEqualIgnoreEol(expected, buffer)); }
public static mtest.struct_dictionary GetDictionary_2() { mtest.struct_dictionary data = new mtest.struct_dictionary(); data.dictionary_one.Add("hello", "world"); data.dictionary_one.Add("red", "blue"); data.dictionary_one.Add("dog", "cat"); mtest.IAggregateType aggr1 = new mtest.AggregateType(); aggr1.name = "aggr1"; aggr1.theAggregate.anInt = -5; aggr1.theAggregate.anUInt = 5; aggr1.theAggregate.aReal = 3.14; aggr1.theAggregate.aString = "hello!"; aggr1.lastValue = 99; mtest.IAggregateType aggr2 = new mtest.AggregateType(); aggr2.name = "aggr1"; aggr2.theAggregate.anInt = -5; aggr2.theAggregate.anUInt = 5; aggr2.theAggregate.aReal = 3.14; aggr2.theAggregate.aString = "hello!"; aggr2.lastValue = 99; mtest.IAggregateType aggr3 = new mtest.AggregateType(); aggr3.name = "aggr1"; aggr3.theAggregate.anInt = -5; aggr3.theAggregate.anUInt = 5; aggr3.theAggregate.aReal = 3.14; aggr3.theAggregate.aString = "hello!"; aggr3.lastValue = 99; data.dictionary_two.Add(2, aggr1); data.dictionary_two.Add(3, aggr2); data.dictionary_two.Add(4, aggr3); mtest.Idu_one du1 = new mtest.du_one(); du1.setCurrentVariant(mtest.du_one_variants.two); du1.Data.Add(-100.001); du1.Data.Add(-200.002); du1.Data.Add(-300.003); mtest.Idu_one du2 = new mtest.du_one(); du2.setCurrentVariant(mtest.du_one_variants.two); du2.Data.Add(-100.001); du2.Data.Add(-200.002); du2.Data.Add(-300.003); mtest.Idu_one du3 = new mtest.du_one(); du3.setCurrentVariant(mtest.du_one_variants.two); du3.Data.Add(-100.001); du3.Data.Add(-200.002); du3.Data.Add(-300.003); data.dictionary_three.Add(-5, du1); data.dictionary_three.Add(-6, du2); data.dictionary_three.Add(-7, du3); mtest.BasicTypes bt = new mtest.BasicTypes(); bt.anInt = -99; bt.aString = "someName"; mtest.BasicTypes bt2 = new mtest.BasicTypes(); bt2.anInt = -98; bt2.aString = "otherName"; data.dictionary_four.Add("someName", bt); data.dictionary_four.Add("otherName", bt2); return(data); }