示例#1
0
        public void TrySerialize_With_Invalid_Object()
        {
            // arrange
            var type  = new GeoJsonPositionType();
            var input = "not a coordinate";

            // act
            var result = type.TrySerialize(input, out object?value);

            // assert
            Assert.False(result);
            Assert.Null(value);
        }
示例#2
0
        public void TryDeserialize_With_Null()
        {
            // arrange
            var    type  = new GeoJsonPositionType();
            object?input = null;

            // act
            var result = type.TrySerialize(input, out object?value);

            // assert
            Assert.True(result);
            Assert.Null(value);
        }
示例#3
0
        public void TrySerialize_With_Nan_3dCoordinate()
        {
            // arrange
            var type  = new GeoJsonPositionType();
            var input = new CoordinateZ(1, 2, double.NaN);

            // act
            var result = type.TrySerialize(input, out object?value);

            // assert
            Assert.True(result);
            Assert.Equal(2, Assert.IsType <double[]>(value).Length);
            Assert.Equal(new[] { 1D, 2D }, Assert.IsType <double[]>(value));
        }