public static void CheckDefaultMessage(Test.TestDefaults.Reader reader) { reader.GetVoidField(); Assert.AreEqual(reader.GetBoolField(), true); Assert.AreEqual(reader.GetInt8Field(), -123); Assert.AreEqual(reader.GetInt16Field(), -12345); Assert.AreEqual(reader.GetInt32Field(), -12345678); Assert.AreEqual(reader.GetInt64Field(), -123456789012345L); Assert.AreEqual(reader.GetUInt8Field(), 0xea); Assert.AreEqual(reader.GetUInt16Field(), 45678); Assert.AreEqual(reader.GetUInt32Field(), 0xce0a6a14); Assert.AreEqual(reader.GetUInt64Field(), 0xab54a98ceb1f0ad2L); Assert.AreEqual(reader.GetFloat32Field(), 1234.5f); Assert.AreEqual(reader.GetFloat64Field(), -123e45); Assert.AreEqual(reader.GetTextField().ToString(), "foo"); Assert.AreEqual(reader.GetDataField().ToArray(), new byte[] { 0x62, 0x61, 0x72 }); { var subReader = reader.GetStructField(); subReader.GetVoidField(); Assert.AreEqual(subReader.GetBoolField(), true); Assert.AreEqual(subReader.GetInt8Field(), -12); Assert.AreEqual(subReader.GetInt16Field(), 3456); Assert.AreEqual(subReader.GetInt32Field(), -78901234); Assert.AreEqual(subReader.GetTextField().ToString(), "baz"); { var subSubReader = subReader.GetStructField(); Assert.AreEqual(subSubReader.GetTextField().ToString(), "nested"); } } Assert.AreEqual(reader.GetEnumField(), Test.TestEnum.Corge); Assert.AreEqual(reader.GetVoidList().Length, 6); { var listReader = reader.GetBoolList(); Assert.AreEqual(listReader.Length, 4); Assert.AreEqual(listReader[0], true); Assert.AreEqual(listReader[1], false); Assert.AreEqual(listReader[2], false); Assert.AreEqual(listReader[3], true); } { var listReader = reader.GetInt8List(); Assert.AreEqual(listReader.Length, 2); Assert.AreEqual(listReader[0], 111); Assert.AreEqual(listReader[1], -111); } }
public static void CheckSettedDefaultMessage(Test.TestDefaults.Reader reader) { Assert.AreEqual(reader.GetBoolField(), false); Assert.AreEqual(reader.GetInt8Field(), -122); Assert.AreEqual(reader.GetInt16Field(), -12344); Assert.AreEqual(reader.GetInt32Field(), -12345677); Assert.AreEqual(reader.GetInt64Field(), -123456789012344L); Assert.AreEqual(reader.GetUInt8Field(), 0xe9); Assert.AreEqual(reader.GetUInt16Field(), 45677); Assert.AreEqual(reader.GetUInt32Field(), 0xce0a6a13); Assert.AreEqual(reader.GetUInt64Field(), 0xab54a98ceb1f0ad1L); Assert.AreEqual(reader.GetFloat32Field(), 1234.4f); Assert.AreEqual(reader.GetFloat64Field(), -123e44); Assert.AreEqual(reader.GetEnumField(), Test.TestEnum.Qux); }