< Summary

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

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
CreateDateTimeConverter()-100%100%
CreateDocumentConverter()-100%100%
CreateDoubleConverter()-100%100%
CreateGeoJsonPointConverter()-100%100%
CreateAllConverters()-100%100%

File(s)

C:\Git\azure-sdk-for-net\sdk\search\Microsoft.Azure.Search.Data\src\Customizations\Serialization\CustomJsonConverters.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 Microsoft.Spatial;
 6using Newtonsoft.Json;
 7using Newtonsoft.Json.Linq;
 8using System.Collections;
 9using System.Collections.Generic;
 10
 11namespace Microsoft.Azure.Search.Serialization.Internal
 12{
 13    /// <summary>
 14    /// Provides access to custom <c cref="JsonConverter">JsonConverter</c> instances used by the Azure
 15    /// Search .NET SDK. For test purposes only.
 16    /// </summary>
 17    /// <remarks>
 18    /// This class is part of the internal implementation of the Azure Cognitive Search .NET SDK. It is not
 19    /// intended to be used directly by application code.
 20    /// </remarks>
 21    public static class CustomJsonConverters
 22    {
 23        /// <summary>
 24        /// Creates a new converter that converts between dates serialized in ISO 8601 format in JSON strings and
 25        /// <c cref="System.DateTime">System.DateTime</c> instances.
 26        /// </summary>
 27        /// <returns>A JSON converter.</returns>
 5828        public static JsonConverter CreateDateTimeConverter() => new Iso8601DateTimeConverter();
 29
 30        /// <summary>
 31        /// Creates a new converter that deserializes JSON objects and arrays to .NET types instead
 32        /// of <c cref="JObject">JObject</c> and <c cref="JArray">JArray</c>.
 33        /// </summary>
 34        /// <returns>A JSON converter.</returns>
 235        public static JsonConverter CreateDocumentConverter() => new DocumentConverter();
 36
 37        /// <summary>
 38        /// Creates a new converter that serializes doubles to and from the OData EDM wire format.
 39        /// </summary>
 40        /// <returns>A JSON converter.</returns>
 2641        public static JsonConverter CreateDoubleConverter() => new EdmDoubleConverter();
 42
 43        /// <summary>
 44        /// Creates a new converter that converts between
 45        /// <c cref="GeographyPoint">Microsoft.Spatial.GeographyPoint</c> objects and Geo-JSON points.
 46        /// </summary>
 47        /// <returns>A JSON converter.</returns>
 2848        public static JsonConverter CreateGeoJsonPointConverter() => new GeoJsonPointConverter();
 49
 50        /// <summary>
 51        /// Creates a collection of all custom converters.
 52        /// </summary>
 53        /// <returns>An enumerable sequence of JSON converters.</returns>
 54        public static IEnumerable<JsonConverter> CreateAllConverters()
 55        {
 256            yield return CreateDateTimeConverter();
 257            yield return CreateDocumentConverter();
 258            yield return CreateDoubleConverter();
 259            yield return CreateGeoJsonPointConverter();
 260        }
 61    }
 62}