public void CanConvert()
        {
            NewtonsoftJsonMicrosoftSpatialGeoJsonConverter converter = new NewtonsoftJsonMicrosoftSpatialGeoJsonConverter();

            Assert.IsFalse(converter.CanConvert(typeof(Geography)));

            // This list is the implementation types. CanConvert will see these when serializing.
            List<Type> types = (from p in GeographyGeoJsons
                                group p by p.Geography.GetType()
                                into grouped
                                select grouped.Key).Distinct().ToList();

            foreach (Type type in types)
            {
                Assert.IsTrue(converter.CanConvert(type));
            }

            // During a deserialization request, you pass the base classes, so these also must pass.
            types = (from p in GeographyGeoJsons
                     group p by p.Geography.GetType().BaseType
                     into grouped
                     select grouped.Key).Distinct().ToList();

            foreach (Type type in types)
            {
                Assert.IsTrue(converter.CanConvert(type));
            }
        }
Exemple #2
0
        public void CanConvert()
        {
            NewtonsoftJsonMicrosoftSpatialGeoJsonConverter converter = new NewtonsoftJsonMicrosoftSpatialGeoJsonConverter();

            Assert.IsTrue(converter.CanConvert(typeof(GeographyPoint)));
        }