< Summary

Class:Azure.Analytics.Synapse.Artifacts.Models.SwitchActivity
Assembly:Azure.Analytics.Synapse.Artifacts
File(s):C:\Git\azure-sdk-for-net\sdk\synapse\Azure.Analytics.Synapse.Artifacts\src\Generated\Models\SwitchActivity.cs
C:\Git\azure-sdk-for-net\sdk\synapse\Azure.Analytics.Synapse.Artifacts\src\Generated\Models\SwitchActivity.Serialization.cs
Covered lines:0
Uncovered lines:113
Coverable lines:113
Total lines:232
Line coverage:0% (0 of 113)
Covered branches:0
Total branches:58
Branch coverage:0% (0 of 58)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor(...)-0%0%
.ctor(...)-0%0%
get_On()-0%100%
get_Cases()-0%100%
get_DefaultActivities()-0%100%
Azure.Core.IUtf8JsonSerializable.Write(...)-0%0%
DeserializeSwitchActivity(...)-0%0%

File(s)

C:\Git\azure-sdk-for-net\sdk\synapse\Azure.Analytics.Synapse.Artifacts\src\Generated\Models\SwitchActivity.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.Collections.Generic;
 10using Azure.Core;
 11
 12namespace Azure.Analytics.Synapse.Artifacts.Models
 13{
 14    /// <summary> This activity evaluates an expression and executes activities under the cases property that correspond
 15    public partial class SwitchActivity : Activity
 16    {
 17        /// <summary> Initializes a new instance of SwitchActivity. </summary>
 18        /// <param name="name"> Activity name. </param>
 19        /// <param name="on"> An expression that would evaluate to a string or integer. This is used to determine the bl
 20        /// <exception cref="ArgumentNullException"> <paramref name="name"/> or <paramref name="on"/> is null. </excepti
 021        public SwitchActivity(string name, Expression @on) : base(name)
 22        {
 023            if (name == null)
 24            {
 025                throw new ArgumentNullException(nameof(name));
 26            }
 027            if (@on == null)
 28            {
 029                throw new ArgumentNullException(nameof(@on));
 30            }
 31
 032            On = @on;
 033            Cases = new ChangeTrackingList<SwitchCase>();
 034            DefaultActivities = new ChangeTrackingList<Activity>();
 035            Type = "Switch";
 036        }
 37
 38        /// <summary> Initializes a new instance of SwitchActivity. </summary>
 39        /// <param name="name"> Activity name. </param>
 40        /// <param name="type"> Type of activity. </param>
 41        /// <param name="description"> Activity description. </param>
 42        /// <param name="dependsOn"> Activity depends on condition. </param>
 43        /// <param name="userProperties"> Activity user properties. </param>
 44        /// <param name="additionalProperties"> . </param>
 45        /// <param name="on"> An expression that would evaluate to a string or integer. This is used to determine the bl
 46        /// <param name="cases"> List of cases that correspond to expected values of the &apos;on&apos; property. This i
 47        /// <param name="defaultActivities"> List of activities to execute if no case condition is satisfied. This is an
 048        internal SwitchActivity(string name, string type, string description, IList<ActivityDependency> dependsOn, IList
 49        {
 050            On = @on;
 051            Cases = cases;
 052            DefaultActivities = defaultActivities;
 053            Type = type ?? "Switch";
 054        }
 55
 56        /// <summary> An expression that would evaluate to a string or integer. This is used to determine the block of a
 057        public Expression On { get; set; }
 58        /// <summary> List of cases that correspond to expected values of the &apos;on&apos; property. This is an option
 059        public IList<SwitchCase> Cases { get; }
 60        /// <summary> List of activities to execute if no case condition is satisfied. This is an optional property and 
 061        public IList<Activity> DefaultActivities { get; }
 62    }
 63}

C:\Git\azure-sdk-for-net\sdk\synapse\Azure.Analytics.Synapse.Artifacts\src\Generated\Models\SwitchActivity.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.Collections.Generic;
 9using System.Text.Json;
 10using Azure.Core;
 11
 12namespace Azure.Analytics.Synapse.Artifacts.Models
 13{
 14    public partial class SwitchActivity : IUtf8JsonSerializable
 15    {
 16        void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
 17        {
 018            writer.WriteStartObject();
 019            writer.WritePropertyName("name");
 020            writer.WriteStringValue(Name);
 021            writer.WritePropertyName("type");
 022            writer.WriteStringValue(Type);
 023            if (Optional.IsDefined(Description))
 24            {
 025                writer.WritePropertyName("description");
 026                writer.WriteStringValue(Description);
 27            }
 028            if (Optional.IsCollectionDefined(DependsOn))
 29            {
 030                writer.WritePropertyName("dependsOn");
 031                writer.WriteStartArray();
 032                foreach (var item in DependsOn)
 33                {
 034                    writer.WriteObjectValue(item);
 35                }
 036                writer.WriteEndArray();
 37            }
 038            if (Optional.IsCollectionDefined(UserProperties))
 39            {
 040                writer.WritePropertyName("userProperties");
 041                writer.WriteStartArray();
 042                foreach (var item in UserProperties)
 43                {
 044                    writer.WriteObjectValue(item);
 45                }
 046                writer.WriteEndArray();
 47            }
 048            writer.WritePropertyName("typeProperties");
 049            writer.WriteStartObject();
 050            writer.WritePropertyName("on");
 051            writer.WriteObjectValue(On);
 052            if (Optional.IsCollectionDefined(Cases))
 53            {
 054                writer.WritePropertyName("cases");
 055                writer.WriteStartArray();
 056                foreach (var item in Cases)
 57                {
 058                    writer.WriteObjectValue(item);
 59                }
 060                writer.WriteEndArray();
 61            }
 062            if (Optional.IsCollectionDefined(DefaultActivities))
 63            {
 064                writer.WritePropertyName("defaultActivities");
 065                writer.WriteStartArray();
 066                foreach (var item in DefaultActivities)
 67                {
 068                    writer.WriteObjectValue(item);
 69                }
 070                writer.WriteEndArray();
 71            }
 072            writer.WriteEndObject();
 073            foreach (var item in AdditionalProperties)
 74            {
 075                writer.WritePropertyName(item.Key);
 076                writer.WriteObjectValue(item.Value);
 77            }
 078            writer.WriteEndObject();
 079        }
 80
 81        internal static SwitchActivity DeserializeSwitchActivity(JsonElement element)
 82        {
 083            string name = default;
 084            string type = default;
 085            Optional<string> description = default;
 086            Optional<IList<ActivityDependency>> dependsOn = default;
 087            Optional<IList<UserProperty>> userProperties = default;
 088            Expression @on = default;
 089            Optional<IList<SwitchCase>> cases = default;
 090            Optional<IList<Activity>> defaultActivities = default;
 091            IDictionary<string, object> additionalProperties = default;
 092            Dictionary<string, object> additionalPropertiesDictionary = default;
 093            foreach (var property in element.EnumerateObject())
 94            {
 095                if (property.NameEquals("name"))
 96                {
 097                    name = property.Value.GetString();
 098                    continue;
 99                }
 0100                if (property.NameEquals("type"))
 101                {
 0102                    type = property.Value.GetString();
 0103                    continue;
 104                }
 0105                if (property.NameEquals("description"))
 106                {
 0107                    description = property.Value.GetString();
 0108                    continue;
 109                }
 0110                if (property.NameEquals("dependsOn"))
 111                {
 0112                    List<ActivityDependency> array = new List<ActivityDependency>();
 0113                    foreach (var item in property.Value.EnumerateArray())
 114                    {
 0115                        array.Add(ActivityDependency.DeserializeActivityDependency(item));
 116                    }
 0117                    dependsOn = array;
 0118                    continue;
 119                }
 0120                if (property.NameEquals("userProperties"))
 121                {
 0122                    List<UserProperty> array = new List<UserProperty>();
 0123                    foreach (var item in property.Value.EnumerateArray())
 124                    {
 0125                        array.Add(UserProperty.DeserializeUserProperty(item));
 126                    }
 0127                    userProperties = array;
 0128                    continue;
 129                }
 0130                if (property.NameEquals("typeProperties"))
 131                {
 0132                    foreach (var property0 in property.Value.EnumerateObject())
 133                    {
 0134                        if (property0.NameEquals("on"))
 135                        {
 0136                            @on = Expression.DeserializeExpression(property0.Value);
 0137                            continue;
 138                        }
 0139                        if (property0.NameEquals("cases"))
 140                        {
 0141                            List<SwitchCase> array = new List<SwitchCase>();
 0142                            foreach (var item in property0.Value.EnumerateArray())
 143                            {
 0144                                array.Add(SwitchCase.DeserializeSwitchCase(item));
 145                            }
 0146                            cases = array;
 0147                            continue;
 148                        }
 0149                        if (property0.NameEquals("defaultActivities"))
 150                        {
 0151                            List<Activity> array = new List<Activity>();
 0152                            foreach (var item in property0.Value.EnumerateArray())
 153                            {
 0154                                array.Add(DeserializeActivity(item));
 155                            }
 0156                            defaultActivities = array;
 157                            continue;
 158                        }
 159                    }
 160                    continue;
 161                }
 0162                additionalPropertiesDictionary ??= new Dictionary<string, object>();
 0163                additionalPropertiesDictionary.Add(property.Name, property.Value.GetObject());
 164            }
 0165            additionalProperties = additionalPropertiesDictionary;
 0166            return new SwitchActivity(name, type, description.Value, Optional.ToList(dependsOn), Optional.ToList(userPro
 167        }
 168    }
 169}