Esempio n. 1
0
        /// <summary>
        /// Serializes the given <see cref="Registration.Models.ComputeType" /> into JSON, by mocking a create request to
        /// exercise the client's serialization logic.
        /// </summary>
        /// <param name="item">The object to serialize.</param>
        /// <returns></returns>
        internal static string SerializeInternalComputeTypeToJson(Registration.Models.ComputeType item)
        {
            var createParams = new Registration.Models.ComputeTypeCreateOrUpdateParameters()
            {
                ComputeType = item
            };

            var    handler           = new MockResourceProviderDelegatingHandler();
            var    client            = GetFakeClient(handler);
            string resourceGroupName = Guid.NewGuid().ToString("D");
            string dataFactoryName   = Guid.NewGuid().ToString("D");

            client.ComputeTypes.CreateOrUpdate(resourceGroupName, dataFactoryName, createParams);
            return(handler.Json);
        }
        /// <summary>
        /// Serializes the given <see cref="Registration.Models.ComputeType" /> into JSON, by mocking a create request to 
        /// exercise the client's serialization logic.
        /// </summary>
        /// <param name="item">The object to serialize.</param>
        /// <returns></returns>
        internal static string SerializeInternalComputeTypeToJson(Registration.Models.ComputeType item)
        {
            var createParams = new Registration.Models.ComputeTypeCreateOrUpdateParameters() { ComputeType = item };

            var handler = new MockResourceProviderDelegatingHandler();
            var client = GetFakeClient(handler);
            string resourceGroupName = Guid.NewGuid().ToString("D");
            string dataFactoryName = Guid.NewGuid().ToString("D");
            client.ComputeTypes.CreateOrUpdate(resourceGroupName, dataFactoryName, createParams);
            return handler.Json;
        }
 /// <summary>
 /// Create or update a ComputeType.
 /// </summary>
 /// <param name='operations'>
 /// Reference to the
 /// Microsoft.Azure.Management.DataFactories.Core.IComputeTypeOperations.
 /// </param>
 /// <param name='resourceGroupName'>
 /// Required. The resource group name of the data factory.
 /// </param>
 /// <param name='dataFactoryName'>
 /// Required. The name of the data factory.
 /// </param>
 /// <param name='parameters'>
 /// Required. The parameters required to create or update a ComputeType
 /// definition.
 /// </param>
 /// <returns>
 /// The create or update ComputeType operation response.
 /// </returns>
 public static Task<ComputeTypeCreateOrUpdateResponse> CreateOrUpdateAsync(this IComputeTypeOperations operations, string resourceGroupName, string dataFactoryName, ComputeTypeCreateOrUpdateParameters parameters)
 {
     return operations.CreateOrUpdateAsync(resourceGroupName, dataFactoryName, parameters, CancellationToken.None);
 }
 /// <summary>
 /// Create or update a ComputeType.
 /// </summary>
 /// <param name='operations'>
 /// Reference to the
 /// Microsoft.Azure.Management.DataFactories.Core.IComputeTypeOperations.
 /// </param>
 /// <param name='resourceGroupName'>
 /// Required. The resource group name of the data factory.
 /// </param>
 /// <param name='dataFactoryName'>
 /// Required. The name of the data factory.
 /// </param>
 /// <param name='parameters'>
 /// Required. The parameters required to create or update a ComputeType
 /// definition.
 /// </param>
 /// <returns>
 /// The create or update ComputeType operation response.
 /// </returns>
 public static ComputeTypeCreateOrUpdateResponse CreateOrUpdate(this IComputeTypeOperations operations, string resourceGroupName, string dataFactoryName, ComputeTypeCreateOrUpdateParameters parameters)
 {
     return Task.Factory.StartNew((object s) => 
     {
         return ((IComputeTypeOperations)s).CreateOrUpdateAsync(resourceGroupName, dataFactoryName, parameters);
     }
     , operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult();
 }