private ComputeType ConvertToWrapper(string json) { CoreRegistrationModel.ComputeType internalComputeType = Core.DataFactoryManagementClient.DeserializeInternalComputeTypeJson(json); return(this.Operations.Converter.ToWrapperType(internalComputeType)); }
/// <summary> /// Initializes a new instance of the /// ComputeTypeCreateOrUpdateParameters class with required arguments. /// </summary> public ComputeTypeCreateOrUpdateParameters(ComputeType computeType) : this() { if (computeType == null) { throw new ArgumentNullException("computeType"); } this.ComputeType = computeType; }
/// <summary> /// Initializes a new instance of the /// ComputeTypeCreateOrUpdateParameters class with required arguments. /// </summary> public ComputeTypeCreateOrUpdateParameters(ComputeType computeType) : this() { if (computeType == null) { throw new ArgumentNullException("computeType"); } this.ComputeType = computeType; }
/// <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); }
private void TestComputeTypeJson(JsonSampleInfo sampleInfo) { string json = sampleInfo.Json; ComputeType computeType = this.ConvertToWrapper(json); CoreRegistrationModel.ComputeType actual = this.Operations.Converter.ToCoreType(computeType); string actualJson = Core.DataFactoryManagementClient.SerializeInternalComputeTypeToJson(actual); JsonComparer.ValidateAreSame(json, actualJson, ignoreDefaultValues: true); Assert.False(actualJson.Contains("ServiceExtraProperties")); JObject actualJObject = JObject.Parse(actualJson); JsonComparer.ValidatePropertyNameCasing(actualJObject, true, string.Empty, sampleInfo.PropertyBagKeys); }
public async Task <ComputeTypeCreateOrUpdateResponse> CreateOrUpdateAsync( string resourceGroupName, string dataFactoryName, ComputeTypeCreateOrUpdateParameters parameters, CancellationToken cancellationToken) { Ensure.IsNotNull(parameters, "parameters"); Ensure.IsNotNull(parameters.ComputeType, "parameters.ComputeType"); Core.Registration.Models.ComputeType internalComputeType = this.Converter.ToCoreType(parameters.ComputeType); Core.Registration.Models.ComputeTypeCreateOrUpdateResponse response = await this.Client.InternalClient.ComputeTypes.CreateOrUpdateAsync( resourceGroupName, dataFactoryName, new Core.Registration.Models.ComputeTypeCreateOrUpdateParameters(internalComputeType)); return(new ComputeTypeCreateOrUpdateResponse(response, this.Client)); }