< Summary

Class:Microsoft.Azure.Batch.Protocol.Models.TaskStateEnumExtension
Assembly:Microsoft.Azure.Batch
File(s):C:\Git\azure-sdk-for-net\sdk\batch\Microsoft.Azure.Batch\src\GeneratedProtocol\Models\TaskState.cs
Covered lines:0
Uncovered lines:11
Coverable lines:11
Total lines:98
Line coverage:0% (0 of 11)
Covered branches:0
Total branches:15
Branch coverage:0% (0 of 15)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
ToSerializedValue(...)-0%0%
ToSerializedValue(...)-0%0%
ParseTaskState(...)-0%0%

File(s)

C:\Git\azure-sdk-for-net\sdk\batch\Microsoft.Azure.Batch\src\GeneratedProtocol\Models\TaskState.cs

#LineLine coverage
 1// <auto-generated>
 2// Copyright (c) Microsoft Corporation. All rights reserved.
 3// Licensed under the MIT License. See License.txt in the project root for
 4// license information.
 5//
 6// Code generated by Microsoft (R) AutoRest Code Generator.
 7// Changes may cause incorrect behavior and will be lost if the code is
 8// regenerated.
 9// </auto-generated>
 10
 11namespace Microsoft.Azure.Batch.Protocol.Models
 12{
 13    using Newtonsoft.Json;
 14    using Newtonsoft.Json.Converters;
 15    using System.Runtime;
 16    using System.Runtime.Serialization;
 17
 18    /// <summary>
 19    /// Defines values for TaskState.
 20    /// </summary>
 21    [JsonConverter(typeof(StringEnumConverter))]
 22    public enum TaskState
 23    {
 24        /// <summary>
 25        /// The Task is queued and able to run, but is not currently assigned
 26        /// to a Compute Node. A Task enters this state when it is created,
 27        /// when it is enabled after being disabled, or when it is awaiting a
 28        /// retry after a failed run.
 29        /// </summary>
 30        [EnumMember(Value = "active")]
 31        Active,
 32        /// <summary>
 33        /// The Task has been assigned to a Compute Node, but is waiting for a
 34        /// required Job Preparation Task to complete on the Compute Node. If
 35        /// the Job Preparation Task succeeds, the Task will move to running.
 36        /// If the Job Preparation Task fails, the Task will return to active
 37        /// and will be eligible to be assigned to a different Compute Node.
 38        /// </summary>
 39        [EnumMember(Value = "preparing")]
 40        Preparing,
 41        /// <summary>
 42        /// The Task is running on a Compute Node. This includes task-level
 43        /// preparation such as downloading resource files or deploying
 44        /// Packages specified on the Task - it does not necessarily mean that
 45        /// the Task command line has started executing.
 46        /// </summary>
 47        [EnumMember(Value = "running")]
 48        Running,
 49        /// <summary>
 50        /// The Task is no longer eligible to run, usually because the Task has
 51        /// finished successfully, or the Task has finished unsuccessfully and
 52        /// has exhausted its retry limit. A Task is also marked as completed
 53        /// if an error occurred launching the Task, or when the Task has been
 54        /// terminated.
 55        /// </summary>
 56        [EnumMember(Value = "completed")]
 57        Completed
 58    }
 59    internal static class TaskStateEnumExtension
 60    {
 61        internal static string ToSerializedValue(this TaskState? value)
 62        {
 063            return value == null ? null : ((TaskState)value).ToSerializedValue();
 64        }
 65
 66        internal static string ToSerializedValue(this TaskState value)
 67        {
 68            switch( value )
 69            {
 70                case TaskState.Active:
 071                    return "active";
 72                case TaskState.Preparing:
 073                    return "preparing";
 74                case TaskState.Running:
 075                    return "running";
 76                case TaskState.Completed:
 077                    return "completed";
 78            }
 079            return null;
 80        }
 81
 82        internal static TaskState? ParseTaskState(this string value)
 83        {
 84            switch( value )
 85            {
 86                case "active":
 087                    return TaskState.Active;
 88                case "preparing":
 089                    return TaskState.Preparing;
 90                case "running":
 091                    return TaskState.Running;
 92                case "completed":
 093                    return TaskState.Completed;
 94            }
 095            return null;
 96        }
 97    }
 98}