< Summary

Class:Microsoft.Azure.Search.Serialization.GeoJsonPointConverter
Assembly:Microsoft.Azure.Search.Data
File(s):C:\Git\azure-sdk-for-net\sdk\search\Microsoft.Azure.Search.Data\src\Customizations\Serialization\GeoJsonPointConverter.cs
Covered lines:3
Uncovered lines:0
Coverable lines:3
Total lines:26
Line coverage:100% (3 of 3)
Covered branches:0
Total branches:0

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
CanConvert(...)-100%100%
ReadJson(...)-100%100%
WriteJson(...)-100%100%

File(s)

C:\Git\azure-sdk-for-net\sdk\search\Microsoft.Azure.Search.Data\src\Customizations\Serialization\GeoJsonPointConverter.cs

#LineLine coverage
 1// Copyright (c) Microsoft Corporation. All rights reserved.
 2// Licensed under the MIT License. See License.txt in the project root for
 3// license information.
 4
 5using System;
 6using System.Reflection;
 7using Microsoft.Spatial;
 8using Newtonsoft.Json;
 9
 10namespace Microsoft.Azure.Search.Serialization
 11{
 12    /// <summary>
 13    /// Converts between <c cref="GeographyPoint">Microsoft.Spatial.GeographyPoint</c> objects and Geo-JSON points.
 14    /// </summary>
 15    internal class GeoJsonPointConverter : JsonConverter
 16    {
 17        public override bool CanConvert(Type objectType) =>
 31163818            typeof(GeographyPoint).GetTypeInfo().IsAssignableFrom(objectType.GetTypeInfo());
 19
 20        public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer seriali
 57621            reader.ReadGeoJsonPoint();
 22
 23        public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) =>
 199424            writer.WriteGeoJsonPoint((GeographyPoint)value);
 25    }
 26}