예제 #1
0
        public static void TestJsonCompose()
        {
            mtest.struct_one msg = GetSampleData();

            SimpleBuffer buffer   = new SimpleBuffer();
            JsonComposer composer = new JsonComposer(buffer);

            mtest.struct_one_message.compose(composer, msg);

            // uncomment to update file
            if (WriteFiles)
            {
                buffer.writeToFile(PathJson);
            }

            SimpleBuffer expected = SimpleBuffer.readFromFile(PathJson);

            Assert.True(JsonPlatform.AreEqual(expected, buffer));
        }
예제 #2
0
        internal static void TestComposeStateSync(ITestPlatformSupport platform, String fileName)
        {
            mtest.StructSix_publisher publ = new  mtest.StructSix_publisher();
            mtest.StructSix           data = GetPublishableSix();
            publ.debugOnlySetData(data);

            SimpleBuffer         buffer   = new SimpleBuffer();
            IPublishableComposer composer = platform.makePublishableComposer(buffer);

            publ.generateStateSyncMessage(composer);

            if (WriteFiles)
            {
                buffer.writeToFile(fileName);
            }

            SimpleBuffer expected = SimpleBuffer.readFromFile(fileName);

            Assert.True(platform.AreEqual(expected, buffer));
        }
        static void TestComposeUpdate(ITestPlatformSupport platform, String fileName, Action <mtest.Ipublishable_seven> updateDelegate)
        {
            mtest.publishable_seven_publisher publ = new mtest.publishable_seven_publisher();
            mtest.publishable_seven           data = GetPublishableSeven();
            publ.debugOnlySetData(data);

            SimpleBuffer         buffer   = new SimpleBuffer();
            IPublishableComposer composer = platform.makePublishableComposer(buffer);

            publ.startTick(composer);

            updateDelegate(publ);

            publ.endTick();

            if (WriteFiles)
            {
                buffer.writeToFile(fileName);
            }

            SimpleBuffer expected = SimpleBuffer.readFromFile(fileName);

            Assert.True(platform.AreEqual(expected, buffer));
        }