public void TheObjectWriter() { var somethingToWrite = new SomethingToWrite { IntProperty = 42 }; var somethingElseToWrite = new SomethingElseToWrite { IntProperty = 42 }; somethingToWrite.SomethingSimple = somethingElseToWrite; somethingElseToWrite.SomethingSimple = somethingToWrite; var stream = new StringStream(); var objectWriter = new ObjectWriter(); objectWriter.Write(stream, somethingToWrite); var reader = stream.ToReader(); Assert.Equal("#1 : SomethingToWrite.", reader.ReadLine()); Assert.Equal(" IntProperty = 42 : Int32.", reader.ReadLine()); Assert.Equal(" SomethingSimple = #2 : SomethingElseToWrite.", reader.ReadLine()); Assert.Equal(" IntProperty = 42 : Int32.", reader.ReadLine()); Assert.Equal(" SomethingSimple = #1 : SomethingToWrite.", reader.ReadLine()); Assert.True(reader.EndOfStream); }
public void TheObjectWriter() { var objectWriter = new ObjectWriter(); objectWriter.Write(new SomethingToWrite()); var reader = objectWriter.ToReader(); Assert.Equal("#1 : SomethingToWrite.", reader.ReadLine()); Assert.Equal(" IntListProperty : [Int32].", reader.ReadLine()); Assert.True(reader.EndOfStream); }
public void TheObjectWriter() { var objectWriter = new ObjectWriter(); objectWriter.Write( new SomethingToWrite { Property = Guid.Empty, OtherProperty = null }); var reader = objectWriter.ToReader(); Assert.Equal("#1 : SomethingToWrite.", reader.ReadLine()); Assert.Equal(" Property = 00000000-0000-0000-0000-000000000000 : Guid.", reader.ReadLine()); Assert.Equal(" OtherProperty = null : Guid.", reader.ReadLine()); ; Assert.True(reader.EndOfStream); }
public void TheObjectWriter() { var objectWriter = new ObjectWriter(); objectWriter.Write( new SomethingComplexToWrite { SomethingSimple = new SomethingToWrite { IntProperty = 42 } }); var reader = objectWriter.ToReader(); Assert.Equal("#1 : SomethingComplexToWrite.", reader.ReadLine()); Assert.Equal(" SomethingSimple = #2 : SomethingToWrite.", reader.ReadLine()); Assert.Equal(" IntProperty = 42 : Int32.", reader.ReadLine()); Assert.True(reader.EndOfStream); }
public void TheObjectWriter() { var stream = new StringStream(); var objectWriter = new ObjectWriter(); objectWriter.Write( stream, new SomethingToWrite { IntProperty = 42, Int32Property = 42, NullableIntProperty = 42, NullableInt32Property = null }); var reader = stream.ToReader(); Assert.Equal("#1 : SomethingToWrite.", reader.ReadLine()); Assert.Equal(" IntProperty = 42 : Int32.", reader.ReadLine()); Assert.Equal(" Int32Property = 42 : Int32.", reader.ReadLine()); Assert.Equal(" NullableIntProperty = 42 : Int32.", reader.ReadLine()); Assert.Equal(" NullableInt32Property = null : Int32.", reader.ReadLine()); Assert.True(reader.EndOfStream); }