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); } }
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); }