private void TestTableJsonSample(JsonSampleInfo sampleInfo)
        {
            Core.Models.Table table =
                Core.DataFactoryManagementClient.DeserializeInternalTableJson(sampleInfo.Json);

            var expectedDataSet = new DataSet()
            {
                Table = this.tableConverter.ToWrapperType(table)
            };

            this.TestDataSetJsonSample("table", expectedDataSet, sampleInfo);
        }
        private void TestLinkedServiceJsonSample(JsonSampleInfo sampleInfo)
        {
            Core.Models.LinkedService linkedService =
                Core.DataFactoryManagementClient.DeserializeInternalLinkedServiceJson(sampleInfo.Json);

            var expectedDataSet = new DataSet()
            {
                LinkedService = this.linkedServiceConverter.ToWrapperType(linkedService)
            };

            this.TestDataSetJsonSample("linkedService", expectedDataSet, sampleInfo);
        }
        public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
        {
            DataSet dataSet = new DataSet();

            JObject jObject = JObject.Load(reader);
            JToken tableJToken;
            JToken linkedServiceJToken;

            if (jObject.TryGetValue(TableToken, StringComparison.OrdinalIgnoreCase, out tableJToken))
            {
                Core.Models.Table internalTable = Core.DataFactoryManagementClient.DeserializeInternalTableJson(tableJToken.ToString());
                dataSet.Table = tableConverter.ToWrapperType(internalTable);
            }

            if (jObject.TryGetValue(LinkedServiceToken, StringComparison.OrdinalIgnoreCase, out linkedServiceJToken))
            {
                Core.Models.LinkedService internalLinkedService = Core.DataFactoryManagementClient.DeserializeInternalLinkedServiceJson(linkedServiceJToken.ToString());
                dataSet.LinkedService = linkedServiceConverter.ToWrapperType(internalLinkedService);
            }

            return dataSet;
        }
 private void TestDataSetJsonSample(string token, DataSet expectedDataSet, JsonSampleInfo sampleInfo)
 {
     DataSet actualDataSet =
         JsonConvert.DeserializeObject<DataSet>(string.Concat("{ \"", token, "\" : ", sampleInfo.Json, "}"));
     Common.ValidateAreSame(expectedDataSet, actualDataSet); 
 }