/// <summary>
        /// Updates or creates a resource based on the resource identifier. The PUT operation is used to update or create a resource by identifier.  If the resource doesn't exist, the resource will be created using that identifier.  Additionally, natural key values cannot be changed using this operation, and will not be modified in the database.  If the resource &quot;id&quot; is provided in the JSON body, it will be ignored as well.
        /// </summary>
        /// <param name="id">A resource identifier specifying the resource to be updated.</param>
        /// <param name="IfMatch">The ETag header value used to prevent the PUT from updating a resource modified by another consumer.</param>
        /// <param name="body">The JSON representation of the &quot;telephoneNumberType&quot; resource to be updated.</param>
        /// <returns>A RestSharp <see cref="IRestResponse"/> instance containing the API response details.</returns>
        public IRestResponse PutTelephoneNumberType(string id, string IfMatch, TelephoneNumberType body)
        {
            var request = new RestRequest("/telephoneNumberTypes/{id}", Method.PUT);

            request.RequestFormat = DataFormat.Json;

            request.AddUrlSegment("id", id);
            // verify required params are set
            if (id == null || body == null)
            {
                throw new ArgumentException("API method call is missing required parameters");
            }
            request.AddHeader("If-Match", IfMatch);
            request.AddBody(body);
            request.Parameters.First(param => param.Type == ParameterType.RequestBody).Name = "application/json";
            var response = client.Execute(request);

            var location = response.Headers.FirstOrDefault(x => x.Name == "Location");

            if (location != null && !string.IsNullOrWhiteSpace(location.Value.ToString()))
            {
                body.id = location.Value.ToString().Split('/').Last();
            }
            return(response);
        }
        /// <summary>
        /// Creates or updates resources based on the natural key values of the supplied resource. The POST operation can be used to create or update resources. In database terms, this is often referred to as an &quot;upsert&quot; operation (insert + update).  Clients should NOT include the resource &quot;id&quot; in the JSON body because it will result in an error (you must use a PUT operation to update a resource by &quot;id&quot;). The web service will identify whether the resource already exists based on the natural key values provided, and update or create the resource appropriately.
        /// </summary>
        /// <param name="body">The JSON representation of the &quot;telephoneNumberType&quot; resource to be created or updated.</param>
        /// <returns>A RestSharp <see cref="IRestResponse"/> instance containing the API response details.</returns>
        public IRestResponse PostTelephoneNumberTypes(TelephoneNumberType body)
        {
            var request = new RestRequest("/telephoneNumberTypes", Method.POST);

            request.RequestFormat = DataFormat.Json;

            // verify required params are set
            if (body == null)
            {
                throw new ArgumentException("API method call is missing required parameters");
            }
            request.AddBody(body);
            var response = client.Execute(request);

            var location = response.Headers.FirstOrDefault(x => x.Name == "Location");

            if (location != null && !string.IsNullOrWhiteSpace(location.Value.ToString()))
            {
                body.id = location.Value.ToString().Split('/').Last();
            }
            return(response);
        }
 public static string ParseTelephoneNumberType(TelephoneNumberType telephoneNumberType)
 {
     switch (telephoneNumberType)
     {
         case TelephoneNumberType.Unknown:
             return "Unknown";
         case TelephoneNumberType.Landline:
             return "Landline";
         case TelephoneNumberType.Mobile:
             return "Mobile";
         default:
             return string.Empty;
     }
 }
 private static bool TelephoneNumberIsMobile(TelephoneNumberType type)
 {
     return type == TelephoneNumberType.Mobile;
 }
        public void ParseTelephoneNumberType_ReturnsCorrectString(TelephoneNumberType telephoneNumberType, string expected)
        {
            //act
            var result = EnumFactory.ParseTelephoneNumberType(telephoneNumberType);

            //assert
            result.Should().Be(expected);
        }
        public void EnumHelper_Parse_ReturnsCorrectEnum(string value, TelephoneNumberType telephoneNumberType)
        {
            //act
            var result = EnumHelper<TelephoneNumberType>.Parse(value);

            //assert
            result.Should().Be(telephoneNumberType);
        }