/// <summary> /// Deserializes the given json into an Hydra OM <see cref="DataFactory" /> instance, by mocking a get request to /// exercise the client's deserialization logic. /// </summary> /// <param name="json"></param> /// <returns></returns> public static DataFactory DeserializeDataFactoryJson(string json) { var handler = new MockResourceProviderDelegatingHandler() { Json = json }; var client = DataPipelineManagementClient.GetFakeClient(handler); string resourceGroupName = Guid.NewGuid().ToString("D"); string dataFactoryName = Guid.NewGuid().ToString("D"); DataFactoryGetResponse getResponse = client.DataFactories.Get(resourceGroupName, dataFactoryName); return(getResponse.DataFactory); }
/// <summary> /// Serializes the given <see cref="DataFactory" /> into JSON, by mocking a create request to /// exercise the client's serialization logic. /// </summary> /// <param name="item"></param> /// <returns></returns> public static string SerializeDataFactoryToJson(DataFactory item) { var createParams = new DataFactoryCreateOrUpdateParameters() { DataFactory = item }; var handler = new MockResourceProviderDelegatingHandler(); var client = DataPipelineManagementClient.GetFakeClient(handler); string resourceGroupName = Guid.NewGuid().ToString("D"); client.DataFactories.BeginCreateOrUpdate(resourceGroupName, createParams); return(handler.Json); }