public void ReadPolyLineMCanReadWrittenPolyLineMShape() { var shape = _fixture.Create <MultiLineString>(); var sut = new PolyLineMShapeContent(shape); using (var stream = new MemoryStream()) { using (var writer = new BinaryWriter(stream, Encoding.ASCII, true)) { sut.Write(writer); writer.Flush(); } stream.Position = 0; using (var reader = new BinaryReader(stream, Encoding.ASCII, true)) { var result = (PolyLineMShapeContent)PolyLineMShapeContent.ReadPolyLineM(reader); Assert.Equal(sut.Shape, result.Shape); Assert.Equal(sut.ShapeType, result.ShapeType); Assert.Equal(sut.ContentLength, result.ContentLength); } } }
public void ReadPolyLineMCanReadWrittenNullShape() { using (var stream = new MemoryStream()) { using (var writer = new BinaryWriter(stream, Encoding.ASCII, true)) { NullShapeContent.Instance.Write(writer); writer.Flush(); } stream.Position = 0; using (var reader = new BinaryReader(stream, Encoding.ASCII, true)) { var result = PolyLineMShapeContent.ReadPolyLineM(reader); Assert.Equal(NullShapeContent.Instance, result); } } }
public void ReadPolyLineMCanNotReadOtherShapeType(ShapeType other) { using (var stream = new MemoryStream()) { using (var writer = new BinaryWriter(stream, Encoding.ASCII, true)) { writer.WriteInt32LittleEndian((int)other); writer.Flush(); } stream.Position = 0; using (var reader = new BinaryReader(stream, Encoding.ASCII, true)) { Assert.Throws <ShapeRecordContentException>( () => PolyLineMShapeContent.ReadPolyLineM(reader) ); } } }
public void ReadPolyLineMReaderCanNotBeNull() { new GuardClauseAssertion(_fixture) .Verify(Methods.Select(() => PolyLineMShapeContent.ReadPolyLineM(null))); }