コード例 #1
0
        /// <summary>
        /// Executes the given call to the RP and returns the response content (i.e. raw json).
        /// </summary>
        /// <param name="operation"></param>
        /// <returns></returns>
        public string GetResponseBody(Action <DataPipelineManagementClient> operation)
        {
            var handler = new ResponseInterceptor();
            DataPipelineManagementClient client = this.WithHandler(handler);

            operation(client);
            return(handler.ResponseBody);
        }
コード例 #2
0
        /// <summary>
        /// Executes the given call to the RP and returns the response content (i.e. raw json).
        /// </summary>
        /// <param name="operation"></param>
        /// <returns></returns>
        public async Task <string> GetResponseBodyAsync(Func <DataPipelineManagementClient, Task> operation)
        {
            var handler = new ResponseInterceptor();
            DataPipelineManagementClient fakeClient = this.WithHandler(handler);

            await operation(fakeClient);

            return(handler.ResponseBody);
        }
コード例 #3
0
        /// <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);
        }
コード例 #4
0
        /// <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);
        }