예제 #1
0
        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);
                }
            }
        }
예제 #2
0
        public void ToBytesWithEncodingHasExpectedResult()
        {
            var sut = new PolyLineMShapeContent(_fixture.Create <MultiLineString>());

            var result = sut.ToBytes(Encoding.UTF8);

            using (var stream = new MemoryStream())
                using (var writer = new BinaryWriter(stream, Encoding.UTF8))
                {
                    sut.Write(writer);
                    writer.Flush();

                    Assert.Equal(stream.ToArray(), result);
                }
        }
예제 #3
0
        public void AnonymousHasExpectedResult()
        {
            var sut = new PolyLineMShapeContent(_fixture.Create <MultiLineString>());

            var result = sut.Anonymous();

            using (var stream = new MemoryStream())
                using (var writer = new BinaryWriter(stream))
                {
                    sut.Write(writer);
                    writer.Flush();

                    Assert.Equal(sut.ShapeType, result.ShapeType);
                    Assert.Equal(sut.ContentLength, result.ContentLength);
                    Assert.Equal(
                        stream.ToArray(),
                        Assert.IsType <AnonymousShapeContent>(result).Content);
                }
        }