Esempio n. 1
0
 public static void Test(WriterRunner action, string expectedHex)
 {
     using (var ms = new MemoryStream())
     {
         using (var pw = ProtoWriter.Create(out var state, ms, RuntimeTypeModel.Default, null))
         {
             action(pw, ref state);
             pw.Close(ref state);
         }
         string s = GetHex(ms.ToArray());
         Assert.Equal(expectedHex, s);
     }
 }
Esempio n. 2
0
        public static void Test(WriterRunner action, string expectedHex)
        {
            using var ms = new MemoryStream();
            var state = ProtoWriter.State.Create(ms, RuntimeTypeModel.Default, null);

            try
            {
                action(ref state);
                state.Close();
            }
            finally
            {
                state.Dispose();
            }
            string s = GetHex(ms.ToArray());

            Assert.Equal(expectedHex, s);
        }