Skip to content

Commit

Permalink
Merge pull request Azure#1016 from kirthik/master
Browse files Browse the repository at this point in the history
Fix for Azure#967: C# generator generates code that contains compiler warnings
  • Loading branch information
kirthik committed May 13, 2016
2 parents 6de0b6d + 9562283 commit a30c462
Showing 14 changed files with 129 additions and 237 deletions.
Original file line number Diff line number Diff line change
@@ -262,12 +262,9 @@ internal DurationOperations(AutoRestDurationTestService client)

// Serialize Request
string _requestContent = null;
if(durationBody != null)
{
_requestContent = SafeJsonConvert.SerializeObject(durationBody, this.Client.SerializationSettings);
_httpRequest.Content = new StringContent(_requestContent, Encoding.UTF8);
_httpRequest.Content.Headers.ContentType = MediaTypeHeaderValue.Parse("application/json; charset=utf-8");
}
_requestContent = SafeJsonConvert.SerializeObject(durationBody, this.Client.SerializationSettings);
_httpRequest.Content = new StringContent(_requestContent, Encoding.UTF8);
_httpRequest.Content.Headers.ContentType = MediaTypeHeaderValue.Parse("application/json; charset=utf-8");
// Set Credentials
if (this.Client.Credentials != null)
{
Original file line number Diff line number Diff line change
@@ -161,12 +161,9 @@ internal ParameterGroupingOperations(AutoRestParameterGroupingTestService client

// Serialize Request
string _requestContent = null;
if(body != null)
{
_requestContent = SafeJsonConvert.SerializeObject(body, this.Client.SerializationSettings);
_httpRequest.Content = new StringContent(_requestContent, Encoding.UTF8);
_httpRequest.Content.Headers.ContentType = MediaTypeHeaderValue.Parse("application/json; charset=utf-8");
}
_requestContent = SafeJsonConvert.SerializeObject(body, this.Client.SerializationSettings);
_httpRequest.Content = new StringContent(_requestContent, Encoding.UTF8);
_httpRequest.Content.Headers.ContentType = MediaTypeHeaderValue.Parse("application/json; charset=utf-8");
// Set Credentials
if (this.Client.Credentials != null)
{
Original file line number Diff line number Diff line change
@@ -217,12 +217,9 @@ public BoolModel(AutoRestBoolTestService client)

// Serialize Request
string _requestContent = null;
if(boolBody != null)
{
_requestContent = SafeJsonConvert.SerializeObject(boolBody, this.Client.SerializationSettings);
_httpRequest.Content = new StringContent(_requestContent, Encoding.UTF8);
_httpRequest.Content.Headers.ContentType = MediaTypeHeaderValue.Parse("application/json; charset=utf-8");
}
_requestContent = SafeJsonConvert.SerializeObject(boolBody, this.Client.SerializationSettings);
_httpRequest.Content = new StringContent(_requestContent, Encoding.UTF8);
_httpRequest.Content.Headers.ContentType = MediaTypeHeaderValue.Parse("application/json; charset=utf-8");
// Send Request
if (_shouldTrace)
{
@@ -446,12 +443,9 @@ public BoolModel(AutoRestBoolTestService client)

// Serialize Request
string _requestContent = null;
if(boolBody != null)
{
_requestContent = SafeJsonConvert.SerializeObject(boolBody, this.Client.SerializationSettings);
_httpRequest.Content = new StringContent(_requestContent, Encoding.UTF8);
_httpRequest.Content.Headers.ContentType = MediaTypeHeaderValue.Parse("application/json; charset=utf-8");
}
_requestContent = SafeJsonConvert.SerializeObject(boolBody, this.Client.SerializationSettings);
_httpRequest.Content = new StringContent(_requestContent, Encoding.UTF8);
_httpRequest.Content.Headers.ContentType = MediaTypeHeaderValue.Parse("application/json; charset=utf-8");
// Send Request
if (_shouldTrace)
{
Original file line number Diff line number Diff line change
@@ -574,12 +574,9 @@ public Date(AutoRestDateTestService client)

// Serialize Request
string _requestContent = null;
if(dateBody != null)
{
_requestContent = SafeJsonConvert.SerializeObject(dateBody, new DateJsonConverter());
_httpRequest.Content = new StringContent(_requestContent, Encoding.UTF8);
_httpRequest.Content.Headers.ContentType = MediaTypeHeaderValue.Parse("application/json; charset=utf-8");
}
_requestContent = SafeJsonConvert.SerializeObject(dateBody, new DateJsonConverter());
_httpRequest.Content = new StringContent(_requestContent, Encoding.UTF8);
_httpRequest.Content.Headers.ContentType = MediaTypeHeaderValue.Parse("application/json; charset=utf-8");
// Send Request
if (_shouldTrace)
{
@@ -803,12 +800,9 @@ public Date(AutoRestDateTestService client)

// Serialize Request
string _requestContent = null;
if(dateBody != null)
{
_requestContent = SafeJsonConvert.SerializeObject(dateBody, new DateJsonConverter());
_httpRequest.Content = new StringContent(_requestContent, Encoding.UTF8);
_httpRequest.Content.Headers.ContentType = MediaTypeHeaderValue.Parse("application/json; charset=utf-8");
}
_requestContent = SafeJsonConvert.SerializeObject(dateBody, new DateJsonConverter());
_httpRequest.Content = new StringContent(_requestContent, Encoding.UTF8);
_httpRequest.Content.Headers.ContentType = MediaTypeHeaderValue.Parse("application/json; charset=utf-8");
// Send Request
if (_shouldTrace)
{
Original file line number Diff line number Diff line change
@@ -574,12 +574,9 @@ public Datetime(AutoRestDateTimeTestService client)

// Serialize Request
string _requestContent = null;
if(datetimeBody != null)
{
_requestContent = SafeJsonConvert.SerializeObject(datetimeBody, this.Client.SerializationSettings);
_httpRequest.Content = new StringContent(_requestContent, Encoding.UTF8);
_httpRequest.Content.Headers.ContentType = MediaTypeHeaderValue.Parse("application/json; charset=utf-8");
}
_requestContent = SafeJsonConvert.SerializeObject(datetimeBody, this.Client.SerializationSettings);
_httpRequest.Content = new StringContent(_requestContent, Encoding.UTF8);
_httpRequest.Content.Headers.ContentType = MediaTypeHeaderValue.Parse("application/json; charset=utf-8");
// Send Request
if (_shouldTrace)
{
@@ -923,12 +920,9 @@ public Datetime(AutoRestDateTimeTestService client)

// Serialize Request
string _requestContent = null;
if(datetimeBody != null)
{
_requestContent = SafeJsonConvert.SerializeObject(datetimeBody, this.Client.SerializationSettings);
_httpRequest.Content = new StringContent(_requestContent, Encoding.UTF8);
_httpRequest.Content.Headers.ContentType = MediaTypeHeaderValue.Parse("application/json; charset=utf-8");
}
_requestContent = SafeJsonConvert.SerializeObject(datetimeBody, this.Client.SerializationSettings);
_httpRequest.Content = new StringContent(_requestContent, Encoding.UTF8);
_httpRequest.Content.Headers.ContentType = MediaTypeHeaderValue.Parse("application/json; charset=utf-8");
// Send Request
if (_shouldTrace)
{
@@ -1274,12 +1268,9 @@ public Datetime(AutoRestDateTimeTestService client)

// Serialize Request
string _requestContent = null;
if(datetimeBody != null)
{
_requestContent = SafeJsonConvert.SerializeObject(datetimeBody, this.Client.SerializationSettings);
_httpRequest.Content = new StringContent(_requestContent, Encoding.UTF8);
_httpRequest.Content.Headers.ContentType = MediaTypeHeaderValue.Parse("application/json; charset=utf-8");
}
_requestContent = SafeJsonConvert.SerializeObject(datetimeBody, this.Client.SerializationSettings);
_httpRequest.Content = new StringContent(_requestContent, Encoding.UTF8);
_httpRequest.Content.Headers.ContentType = MediaTypeHeaderValue.Parse("application/json; charset=utf-8");
// Send Request
if (_shouldTrace)
{
@@ -1624,12 +1615,9 @@ public Datetime(AutoRestDateTimeTestService client)

// Serialize Request
string _requestContent = null;
if(datetimeBody != null)
{
_requestContent = SafeJsonConvert.SerializeObject(datetimeBody, this.Client.SerializationSettings);
_httpRequest.Content = new StringContent(_requestContent, Encoding.UTF8);
_httpRequest.Content.Headers.ContentType = MediaTypeHeaderValue.Parse("application/json; charset=utf-8");
}
_requestContent = SafeJsonConvert.SerializeObject(datetimeBody, this.Client.SerializationSettings);
_httpRequest.Content = new StringContent(_requestContent, Encoding.UTF8);
_httpRequest.Content.Headers.ContentType = MediaTypeHeaderValue.Parse("application/json; charset=utf-8");
// Send Request
if (_shouldTrace)
{
@@ -1853,12 +1841,9 @@ public Datetime(AutoRestDateTimeTestService client)

// Serialize Request
string _requestContent = null;
if(datetimeBody != null)
{
_requestContent = SafeJsonConvert.SerializeObject(datetimeBody, this.Client.SerializationSettings);
_httpRequest.Content = new StringContent(_requestContent, Encoding.UTF8);
_httpRequest.Content.Headers.ContentType = MediaTypeHeaderValue.Parse("application/json; charset=utf-8");
}
_requestContent = SafeJsonConvert.SerializeObject(datetimeBody, this.Client.SerializationSettings);
_httpRequest.Content = new StringContent(_requestContent, Encoding.UTF8);
_httpRequest.Content.Headers.ContentType = MediaTypeHeaderValue.Parse("application/json; charset=utf-8");
// Send Request
if (_shouldTrace)
{
@@ -2082,12 +2067,9 @@ public Datetime(AutoRestDateTimeTestService client)

// Serialize Request
string _requestContent = null;
if(datetimeBody != null)
{
_requestContent = SafeJsonConvert.SerializeObject(datetimeBody, this.Client.SerializationSettings);
_httpRequest.Content = new StringContent(_requestContent, Encoding.UTF8);
_httpRequest.Content.Headers.ContentType = MediaTypeHeaderValue.Parse("application/json; charset=utf-8");
}
_requestContent = SafeJsonConvert.SerializeObject(datetimeBody, this.Client.SerializationSettings);
_httpRequest.Content = new StringContent(_requestContent, Encoding.UTF8);
_httpRequest.Content.Headers.ContentType = MediaTypeHeaderValue.Parse("application/json; charset=utf-8");
// Send Request
if (_shouldTrace)
{
Original file line number Diff line number Diff line change
@@ -574,12 +574,9 @@ public Datetimerfc1123(AutoRestRFC1123DateTimeTestService client)

// Serialize Request
string _requestContent = null;
if(datetimeBody != null)
{
_requestContent = SafeJsonConvert.SerializeObject(datetimeBody, new DateTimeRfc1123JsonConverter());
_httpRequest.Content = new StringContent(_requestContent, Encoding.UTF8);
_httpRequest.Content.Headers.ContentType = MediaTypeHeaderValue.Parse("application/json; charset=utf-8");
}
_requestContent = SafeJsonConvert.SerializeObject(datetimeBody, new DateTimeRfc1123JsonConverter());
_httpRequest.Content = new StringContent(_requestContent, Encoding.UTF8);
_httpRequest.Content.Headers.ContentType = MediaTypeHeaderValue.Parse("application/json; charset=utf-8");
// Send Request
if (_shouldTrace)
{
@@ -922,12 +919,9 @@ public Datetimerfc1123(AutoRestRFC1123DateTimeTestService client)

// Serialize Request
string _requestContent = null;
if(datetimeBody != null)
{
_requestContent = SafeJsonConvert.SerializeObject(datetimeBody, new DateTimeRfc1123JsonConverter());
_httpRequest.Content = new StringContent(_requestContent, Encoding.UTF8);
_httpRequest.Content.Headers.ContentType = MediaTypeHeaderValue.Parse("application/json; charset=utf-8");
}
_requestContent = SafeJsonConvert.SerializeObject(datetimeBody, new DateTimeRfc1123JsonConverter());
_httpRequest.Content = new StringContent(_requestContent, Encoding.UTF8);
_httpRequest.Content.Headers.ContentType = MediaTypeHeaderValue.Parse("application/json; charset=utf-8");
// Send Request
if (_shouldTrace)
{
Original file line number Diff line number Diff line change
@@ -217,12 +217,9 @@ public Duration(AutoRestDurationTestService client)

// Serialize Request
string _requestContent = null;
if(durationBody != null)
{
_requestContent = SafeJsonConvert.SerializeObject(durationBody, this.Client.SerializationSettings);
_httpRequest.Content = new StringContent(_requestContent, Encoding.UTF8);
_httpRequest.Content.Headers.ContentType = MediaTypeHeaderValue.Parse("application/json; charset=utf-8");
}
_requestContent = SafeJsonConvert.SerializeObject(durationBody, this.Client.SerializationSettings);
_httpRequest.Content = new StringContent(_requestContent, Encoding.UTF8);
_httpRequest.Content.Headers.ContentType = MediaTypeHeaderValue.Parse("application/json; charset=utf-8");
// Send Request
if (_shouldTrace)
{
Original file line number Diff line number Diff line change
@@ -812,12 +812,9 @@ public IntModel(AutoRestIntegerTestService client)

// Serialize Request
string _requestContent = null;
if(intBody != null)
{
_requestContent = SafeJsonConvert.SerializeObject(intBody, this.Client.SerializationSettings);
_httpRequest.Content = new StringContent(_requestContent, Encoding.UTF8);
_httpRequest.Content.Headers.ContentType = MediaTypeHeaderValue.Parse("application/json; charset=utf-8");
}
_requestContent = SafeJsonConvert.SerializeObject(intBody, this.Client.SerializationSettings);
_httpRequest.Content = new StringContent(_requestContent, Encoding.UTF8);
_httpRequest.Content.Headers.ContentType = MediaTypeHeaderValue.Parse("application/json; charset=utf-8");
// Send Request
if (_shouldTrace)
{
@@ -922,12 +919,9 @@ public IntModel(AutoRestIntegerTestService client)

// Serialize Request
string _requestContent = null;
if(intBody != null)
{
_requestContent = SafeJsonConvert.SerializeObject(intBody, this.Client.SerializationSettings);
_httpRequest.Content = new StringContent(_requestContent, Encoding.UTF8);
_httpRequest.Content.Headers.ContentType = MediaTypeHeaderValue.Parse("application/json; charset=utf-8");
}
_requestContent = SafeJsonConvert.SerializeObject(intBody, this.Client.SerializationSettings);
_httpRequest.Content = new StringContent(_requestContent, Encoding.UTF8);
_httpRequest.Content.Headers.ContentType = MediaTypeHeaderValue.Parse("application/json; charset=utf-8");
// Send Request
if (_shouldTrace)
{
@@ -1032,12 +1026,9 @@ public IntModel(AutoRestIntegerTestService client)

// Serialize Request
string _requestContent = null;
if(intBody != null)
{
_requestContent = SafeJsonConvert.SerializeObject(intBody, this.Client.SerializationSettings);
_httpRequest.Content = new StringContent(_requestContent, Encoding.UTF8);
_httpRequest.Content.Headers.ContentType = MediaTypeHeaderValue.Parse("application/json; charset=utf-8");
}
_requestContent = SafeJsonConvert.SerializeObject(intBody, this.Client.SerializationSettings);
_httpRequest.Content = new StringContent(_requestContent, Encoding.UTF8);
_httpRequest.Content.Headers.ContentType = MediaTypeHeaderValue.Parse("application/json; charset=utf-8");
// Send Request
if (_shouldTrace)
{
@@ -1142,12 +1133,9 @@ public IntModel(AutoRestIntegerTestService client)

// Serialize Request
string _requestContent = null;
if(intBody != null)
{
_requestContent = SafeJsonConvert.SerializeObject(intBody, this.Client.SerializationSettings);
_httpRequest.Content = new StringContent(_requestContent, Encoding.UTF8);
_httpRequest.Content.Headers.ContentType = MediaTypeHeaderValue.Parse("application/json; charset=utf-8");
}
_requestContent = SafeJsonConvert.SerializeObject(intBody, this.Client.SerializationSettings);
_httpRequest.Content = new StringContent(_requestContent, Encoding.UTF8);
_httpRequest.Content.Headers.ContentType = MediaTypeHeaderValue.Parse("application/json; charset=utf-8");
// Send Request
if (_shouldTrace)
{
@@ -1371,12 +1359,9 @@ public IntModel(AutoRestIntegerTestService client)

// Serialize Request
string _requestContent = null;
if(intBody != null)
{
_requestContent = SafeJsonConvert.SerializeObject(intBody, new UnixTimeJsonConverter());
_httpRequest.Content = new StringContent(_requestContent, Encoding.UTF8);
_httpRequest.Content.Headers.ContentType = MediaTypeHeaderValue.Parse("application/json; charset=utf-8");
}
_requestContent = SafeJsonConvert.SerializeObject(intBody, new UnixTimeJsonConverter());
_httpRequest.Content = new StringContent(_requestContent, Encoding.UTF8);
_httpRequest.Content.Headers.ContentType = MediaTypeHeaderValue.Parse("application/json; charset=utf-8");
// Send Request
if (_shouldTrace)
{
Loading

0 comments on commit a30c462

Please sign in to comment.