public void Read_InvalidMarkerWithReferenceType_Throws() { var buffer = new DummyBuffer(); var bufferReaderMock = new Mock <IBufferReader <DummyBuffer> >(MockBehavior.Strict); bufferReaderMock.SetupNullMarker(invalid: true).Verifiable(); var context = new ReadFormatContext <DummyBuffer>(bufferReaderMock.Object, buffer); Assert.Throws(Is.TypeOf <FormattingException>().And.Message.EqualTo("Invalid null marker found: 2"), () => context.Read <TestClass1>()); }
public void Read_NullDataWithReferenceType_ReturnsNull() { var buffer = new DummyBuffer(); var bufferReaderMock = new Mock <IBufferReader <DummyBuffer> >(MockBehavior.Strict); bufferReaderMock.SetupNullMarker(true).Verifiable(); var context = new ReadFormatContext <DummyBuffer>(bufferReaderMock.Object, buffer); var data = context.Read <TestClass1>(); Assert.AreEqual(null, data); }