< Summary

Class:Azure.Search.Documents.Indexes.Models.SearchFieldDataType
Assembly:Azure.Search.Documents
File(s):C:\Git\azure-sdk-for-net\sdk\search\Azure.Search.Documents\src\Generated\Models\SearchFieldDataType.cs
C:\Git\azure-sdk-for-net\sdk\search\Azure.Search.Documents\src\Indexes\Models\SearchFieldDataType.cs
Covered lines:16
Uncovered lines:3
Coverable lines:19
Total lines:111
Line coverage:84.2% (16 of 19)
Covered branches:3
Total branches:8
Branch coverage:37.5% (3 of 8)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor(...)-100%50%
op_Equality(...)-0%100%
op_Inequality(...)-100%100%
op_Implicit(...)-100%100%
Equals(...)-0%0%
Equals(...)-100%100%
GetHashCode()-0%0%
ToString()-100%100%
get_String()-100%100%
get_Int32()-100%100%
get_Int64()-100%100%
get_Double()-100%100%
get_Boolean()-100%100%
get_DateTimeOffset()-100%100%
get_GeographyPoint()-100%100%
get_Complex()-100%100%
Collection(...)-100%100%
get_IsCollection()-100%100%

File(s)

C:\Git\azure-sdk-for-net\sdk\search\Azure.Search.Documents\src\Generated\Models\SearchFieldDataType.cs

#LineLine coverage
 1// Copyright (c) Microsoft Corporation. All rights reserved.
 2// Licensed under the MIT License.
 3
 4// <auto-generated/>
 5
 6#nullable disable
 7
 8using System;
 9using System.ComponentModel;
 10
 11namespace Azure.Search.Documents.Indexes.Models
 12{
 13    /// <summary> Defines the data type of a field in a search index. </summary>
 14    public readonly partial struct SearchFieldDataType : IEquatable<SearchFieldDataType>
 15    {
 16        private readonly string _value;
 17
 18        /// <summary> Determines if two <see cref="SearchFieldDataType"/> values are the same. </summary>
 19        /// <exception cref="ArgumentNullException"> <paramref name="value"/> is null. </exception>
 20        public SearchFieldDataType(string value)
 21        {
 627322            _value = value ?? throw new ArgumentNullException(nameof(value));
 627323        }
 24
 25        private const string StringValue = "Edm.String";
 26        private const string Int32Value = "Edm.Int32";
 27        private const string Int64Value = "Edm.Int64";
 28        private const string DoubleValue = "Edm.Double";
 29        private const string BooleanValue = "Edm.Boolean";
 30        private const string DateTimeOffsetValue = "Edm.DateTimeOffset";
 31        private const string GeographyPointValue = "Edm.GeographyPoint";
 32        private const string ComplexValue = "Edm.ComplexType";
 33        /// <summary> Determines if two <see cref="SearchFieldDataType"/> values are the same. </summary>
 034        public static bool operator ==(SearchFieldDataType left, SearchFieldDataType right) => left.Equals(right);
 35        /// <summary> Determines if two <see cref="SearchFieldDataType"/> values are not the same. </summary>
 5936        public static bool operator !=(SearchFieldDataType left, SearchFieldDataType right) => !left.Equals(right);
 37        /// <summary> Converts a string to a <see cref="SearchFieldDataType"/>. </summary>
 438        public static implicit operator SearchFieldDataType(string value) => new SearchFieldDataType(value);
 39
 40        /// <inheritdoc />
 41        [EditorBrowsable(EditorBrowsableState.Never)]
 042        public override bool Equals(object obj) => obj is SearchFieldDataType other && Equals(other);
 43        /// <inheritdoc />
 93944        public bool Equals(SearchFieldDataType other) => string.Equals(_value, other._value, StringComparison.InvariantC
 45
 46        /// <inheritdoc />
 47        [EditorBrowsable(EditorBrowsableState.Never)]
 048        public override int GetHashCode() => _value?.GetHashCode() ?? 0;
 49        /// <inheritdoc />
 53850        public override string ToString() => _value;
 51    }
 52}

C:\Git\azure-sdk-for-net\sdk\search\Azure.Search.Documents\src\Indexes\Models\SearchFieldDataType.cs

#LineLine coverage
 1// Copyright (c) Microsoft Corporation. All rights reserved.
 2// Licensed under the MIT License.
 3
 4using System;
 5using Azure.Core;
 6
 7namespace Azure.Search.Documents.Indexes.Models
 8{
 9    public readonly partial struct SearchFieldDataType
 10    {
 11        private const string CollectionPrefix = "Collection(";
 12
 13#pragma warning disable CA1720 // Identifier contains type name
 14        /// <summary>A <see cref="string"/> type.</summary>
 15        [CodeGenMember("EdmString")]
 113216        public static SearchFieldDataType String { get; } = new SearchFieldDataType(StringValue);
 17
 18        /// <summary>An <see cref="int"/> type, or something that can convert to an <see cref="int"/>.</summary>
 19        [CodeGenMember("EdmInt32")]
 2220        public static SearchFieldDataType Int32 { get; } = new SearchFieldDataType(Int32Value);
 21
 22        /// <summary>An <see cref="long"/> type, or something that can convert to an <see cref="long"/>.</summary>
 23        [CodeGenMember("EdmInt64")]
 924        public static SearchFieldDataType Int64 { get; } = new SearchFieldDataType(Int64Value);
 25
 26        /// <summary>A <see cref="double"/> type, or something that can convert to a <see cref="double"/>.</summary>
 27        [CodeGenMember("EdmDouble")]
 1328        public static SearchFieldDataType Double { get; } = new SearchFieldDataType(DoubleValue);
 29#pragma warning restore CA1720 // Identifier contains type name
 30
 31        /// <summary>A <see cref="bool"/> type.</summary>
 32        [CodeGenMember("EdmBoolean")]
 2133        public static SearchFieldDataType Boolean { get; } = new SearchFieldDataType(BooleanValue);
 34
 35        /// <summary>A <see cref="System.DateTimeOffset"/> type, or <see cref="System.DateTime"/> converted to a <see cr
 36        [CodeGenMember("EdmDateTimeOffset")]
 2037        public static SearchFieldDataType DateTimeOffset { get; } = new SearchFieldDataType(DateTimeOffsetValue);
 38
 39        /// <summary>A geographic point type.</summary>
 40        [CodeGenMember("EdmGeographyPoint")]
 641        public static SearchFieldDataType GeographyPoint { get; } = new SearchFieldDataType(GeographyPointValue);
 42
 43        /// <summary>A complex type with child fields.</summary>
 44        [CodeGenMember("EdmComplexType")]
 316145        public static SearchFieldDataType Complex { get; } = new SearchFieldDataType(ComplexValue);
 46
 47        /// <summary>
 48        /// Gets a <see cref="SearchFieldDataType"/> representing a collection of <paramref name="type"/>.
 49        /// </summary>
 50        /// <param name="type">The type of collection.</param>
 51        /// <returns>A <see cref="SearchFieldDataType"/> representing a collection of <paramref name="type"/>.</returns>
 595252        public static SearchFieldDataType Collection(SearchFieldDataType type) => type.IsCollection ? type : new SearchF
 53
 54        /// <summary>
 55        /// Gets a value indicating whether the <see cref="SearchFieldDataType"/> represents a collection.
 56        /// </summary>
 595457        public bool IsCollection => _value.StartsWith(CollectionPrefix, StringComparison.InvariantCultureIgnoreCase);
 58    }
 59}