コード例 #1
0
        public void TestAllTypesToString()
        {
            TestAllTypesLite msg  = TestAllTypesLite.DefaultInstance;
            TestAllTypesLite copy = msg.ToBuilder().Build();

            Assert.AreEqual(msg.ToString(), copy.ToString());
            Assert.IsEmpty(msg.ToString());
            msg = msg.ToBuilder().SetOptionalInt32(-1).Build();
            Assert.AreEqual("optional_int32: -1", msg.ToString().TrimEnd());
            msg = msg.ToBuilder().SetOptionalString("abc123").Build();
            Assert.AreEqual("optional_int32: -1\noptional_string: \"abc123\"", msg.ToString().Replace("\r", "").TrimEnd());
        }