< Summary

Class:Azure.Search.Documents.Indexes.Models.DataSourceCredentials
Assembly:Azure.Search.Documents
File(s):C:\Git\azure-sdk-for-net\sdk\search\Azure.Search.Documents\src\Generated\Models\DataSourceCredentials.cs
C:\Git\azure-sdk-for-net\sdk\search\Azure.Search.Documents\src\Generated\Models\DataSourceCredentials.Serialization.cs
Covered lines:15
Uncovered lines:2
Coverable lines:17
Total lines:68
Line coverage:88.2% (15 of 17)
Covered branches:6
Total branches:6
Branch coverage:100% (6 of 6)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor()-0%100%
.ctor(...)-100%100%
get_ConnectionString()-100%100%
Azure.Core.IUtf8JsonSerializable.Write(...)-100%100%
DeserializeDataSourceCredentials(...)-100%100%

File(s)

C:\Git\azure-sdk-for-net\sdk\search\Azure.Search.Documents\src\Generated\Models\DataSourceCredentials.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
 8namespace Azure.Search.Documents.Indexes.Models
 9{
 10    /// <summary> Represents credentials that can be used to connect to a datasource. </summary>
 11    internal partial class DataSourceCredentials
 12    {
 13        /// <summary> Initializes a new instance of DataSourceCredentials. </summary>
 014        public DataSourceCredentials()
 15        {
 016        }
 17
 18        /// <summary> Initializes a new instance of DataSourceCredentials. </summary>
 19        /// <param name="connectionString"> The connection string for the datasource. </param>
 1620        internal DataSourceCredentials(string connectionString)
 21        {
 1622            ConnectionString = connectionString;
 1623        }
 24
 25        /// <summary> The connection string for the datasource. </summary>
 3926        public string ConnectionString { get; set; }
 27    }
 28}

C:\Git\azure-sdk-for-net\sdk\search\Azure.Search.Documents\src\Generated\Models\DataSourceCredentials.Serialization.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.Text.Json;
 9using Azure.Core;
 10
 11namespace Azure.Search.Documents.Indexes.Models
 12{
 13    internal partial class DataSourceCredentials : IUtf8JsonSerializable
 14    {
 15        void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
 16        {
 717            writer.WriteStartObject();
 718            if (Optional.IsDefined(ConnectionString))
 19            {
 720                writer.WritePropertyName("connectionString");
 721                writer.WriteStringValue(ConnectionString);
 22            }
 723            writer.WriteEndObject();
 724        }
 25
 26        internal static DataSourceCredentials DeserializeDataSourceCredentials(JsonElement element)
 27        {
 928            Optional<string> connectionString = default;
 3629            foreach (var property in element.EnumerateObject())
 30            {
 931                if (property.NameEquals("connectionString"))
 32                {
 933                    connectionString = property.Value.GetString();
 34                    continue;
 35                }
 36            }
 937            return new DataSourceCredentials(connectionString.Value);
 38        }
 39    }
 40}