Skip to content

Commit

Permalink
Respond to PR comments, regenerate code for tests
Browse files Browse the repository at this point in the history
  • Loading branch information
matthchr committed Oct 14, 2015
1 parent 73e51d2 commit 2acb4ee
Show file tree
Hide file tree
Showing 43 changed files with 16 additions and 117 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ public static void AddParameterGroups(ServiceClient serviceClient)

foreach (Method method in serviceClient.Methods)
{
//TODO: Does this group name need to be normalized later, or does that already happen?
//This group name is normalized by each languages code generator later, so it need not happen here.
Dictionary<string, List<Property>> properties = new Dictionary<string, List<Property>>();
foreach (Parameter parameter in method.Parameters)
{
Expand All @@ -241,10 +241,10 @@ public static void AddParameterGroups(ServiceClient serviceClient)
properties[parameterGroupName].Add(new Property()
{
IsReadOnly = false, //Since these properties are used as parameters they are never read only
Name = CodeNamer.PascalCase(parameter.Name),
Name = parameter.Name,
IsRequired = parameter.IsRequired,
DefaultValue = parameter.DefaultValue,
//Constraints = parameter.Constraints, TODO do these need to be copied?
//Constraints = parameter.Constraints, Omit these since we don't want to perform parameter validation
Documentation = parameter.Documentation,
Type = parameter.Type,
SerializedName = null //Parameter is never serialized directly
Expand Down
26 changes: 13 additions & 13 deletions AutoRest/Generators/CSharp/Azure.CSharp.Tests/AcceptanceTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -690,31 +690,31 @@ public void CustomNamedRequestIdTest()
[Fact]
public void ParameterGroupingTests()
{
const int body = 1234;
const string header = "header";
const int query = 21;
const string path = "path";
const int bodyParameter = 1234;
const string headerParameter = "header";
const int queryParameter = 21;
const string pathParameter = "path";

using (var client = new AutoRestParameterGroupingTestService(
Fixture.Uri,
new TokenCredentials(Guid.NewGuid().ToString())))
{
//Valid required parameters
ParameterGroupingPostRequiredParameters requiredParameters = new ParameterGroupingPostRequiredParameters(body, path)
ParameterGroupingPostRequiredParameters requiredParameters = new ParameterGroupingPostRequiredParameters(bodyParameter, pathParameter)
{
Header = header,
Query = query
Header = headerParameter,
Query = queryParameter
};

client.ParameterGrouping.PostRequired(requiredParameters);

//Required parameters but null optional parameters
requiredParameters = new ParameterGroupingPostRequiredParameters(body, path);
requiredParameters = new ParameterGroupingPostRequiredParameters(bodyParameter, pathParameter);

client.ParameterGrouping.PostRequired(requiredParameters);

//Required parameters object is not null, but a required property of the object is
requiredParameters = new ParameterGroupingPostRequiredParameters(null, path);
requiredParameters = new ParameterGroupingPostRequiredParameters(null, pathParameter);
Assert.Throws<ValidationException>(() => client.ParameterGrouping.PostRequired(requiredParameters));

//null required parameters
Expand All @@ -723,8 +723,8 @@ public void ParameterGroupingTests()
//Valid optional parameters
ParameterGroupingPostOptionalParameters optionalParameters = new ParameterGroupingPostOptionalParameters()
{
Header = header,
Query = query
Header = headerParameter,
Query = queryParameter
};

client.ParameterGrouping.PostOptional(optionalParameters);
Expand All @@ -733,13 +733,13 @@ public void ParameterGroupingTests()
client.ParameterGrouping.PostOptional(null);

//Multiple grouped parameters
FirstParameterGroup firstGroup = new FirstParameterGroup(header, query);
FirstParameterGroup firstGroup = new FirstParameterGroup(headerParameter, queryParameter);
SecondParameterGroup secondGroup = new SecondParameterGroup("header2", 42);

client.ParameterGrouping.PostMultipleParameterGroups(firstGroup, secondGroup);

//Multiple grouped parameters -- some optional parameters omitted
firstGroup = new FirstParameterGroup(header);
firstGroup = new FirstParameterGroup(headerParameter);
secondGroup = new SecondParameterGroup(queryTwo: 42);

client.ParameterGrouping.PostMultipleParameterGroups(firstGroup, secondGroup);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,6 @@
namespace Fixtures.Azure.AcceptanceTestsAzureParameterGrouping
{
using System;
using System.Linq;
using System.Collections.Generic;
using System.Net;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Rest;
using Microsoft.Rest.Serialization;
using Newtonsoft.Json;

/// <summary>
/// Additional parameters for the postMultipleParameterGroups operation.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,6 @@
namespace Fixtures.Azure.AcceptanceTestsAzureParameterGrouping
{
using System;
using System.Linq;
using System.Collections.Generic;
using System.Net;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Rest;
using Microsoft.Rest.Serialization;
using Newtonsoft.Json;

/// <summary>
/// Additional parameters for the postOptional operation.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,6 @@
namespace Fixtures.Azure.AcceptanceTestsAzureParameterGrouping
{
using System;
using System.Linq;
using System.Collections.Generic;
using System.Net;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Rest;
using Microsoft.Rest.Serialization;
using Newtonsoft.Json;

/// <summary>
/// Additional parameters for the postRequired operation.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,6 @@
namespace Fixtures.Azure.AcceptanceTestsAzureParameterGrouping
{
using System;
using System.Linq;
using System.Collections.Generic;
using System.Net;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Rest;
using Microsoft.Rest.Serialization;
using Newtonsoft.Json;

/// <summary>
/// Additional parameters for the postMultipleParameterGroups operation.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ namespace Fixtures.AcceptanceTestsBodyArray
using System;
using System.Linq;
using System.Collections.Generic;
using System.Globalization;
using System.Net;
using System.Net.Http;
using System.Net.Http.Headers;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ namespace Fixtures.AcceptanceTestsBodyBoolean
using System;
using System.Linq;
using System.Collections.Generic;
using System.Globalization;
using System.Net;
using System.Net.Http;
using System.Net.Http.Headers;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ namespace Fixtures.AcceptanceTestsBodyByte
using System;
using System.Linq;
using System.Collections.Generic;
using System.Globalization;
using System.Net;
using System.Net.Http;
using System.Net.Http.Headers;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ namespace Fixtures.AcceptanceTestsBodyComplex
using System;
using System.Linq;
using System.Collections.Generic;
using System.Globalization;
using System.Net;
using System.Net.Http;
using System.Net.Http.Headers;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ namespace Fixtures.AcceptanceTestsBodyComplex
using System;
using System.Linq;
using System.Collections.Generic;
using System.Globalization;
using System.Net;
using System.Net.Http;
using System.Net.Http.Headers;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ namespace Fixtures.AcceptanceTestsBodyComplex
using System;
using System.Linq;
using System.Collections.Generic;
using System.Globalization;
using System.Net;
using System.Net.Http;
using System.Net.Http.Headers;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ namespace Fixtures.AcceptanceTestsBodyComplex
using System;
using System.Linq;
using System.Collections.Generic;
using System.Globalization;
using System.Net;
using System.Net.Http;
using System.Net.Http.Headers;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ namespace Fixtures.AcceptanceTestsBodyComplex
using System;
using System.Linq;
using System.Collections.Generic;
using System.Globalization;
using System.Net;
using System.Net.Http;
using System.Net.Http.Headers;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ namespace Fixtures.AcceptanceTestsBodyComplex
using System;
using System.Linq;
using System.Collections.Generic;
using System.Globalization;
using System.Net;
using System.Net.Http;
using System.Net.Http.Headers;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ namespace Fixtures.AcceptanceTestsBodyComplex
using System;
using System.Linq;
using System.Collections.Generic;
using System.Globalization;
using System.Net;
using System.Net.Http;
using System.Net.Http.Headers;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ namespace Fixtures.AcceptanceTestsBodyDate
using System;
using System.Linq;
using System.Collections.Generic;
using System.Globalization;
using System.Net;
using System.Net.Http;
using System.Net.Http.Headers;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ namespace Fixtures.AcceptanceTestsBodyDateTime
using System;
using System.Linq;
using System.Collections.Generic;
using System.Globalization;
using System.Net;
using System.Net.Http;
using System.Net.Http.Headers;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ namespace Fixtures.AcceptanceTestsBodyDictionary
using System;
using System.Linq;
using System.Collections.Generic;
using System.Globalization;
using System.Net;
using System.Net.Http;
using System.Net.Http.Headers;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ namespace Fixtures.AcceptanceTestsBodyDuration
using System;
using System.Linq;
using System.Collections.Generic;
using System.Globalization;
using System.Net;
using System.Net.Http;
using System.Net.Http.Headers;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ namespace Fixtures.AcceptanceTestsBodyFile
using System;
using System.Linq;
using System.Collections.Generic;
using System.Globalization;
using System.Net;
using System.Net.Http;
using System.Net.Http.Headers;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ namespace Fixtures.AcceptanceTestsBodyInteger
using System;
using System.Linq;
using System.Collections.Generic;
using System.Globalization;
using System.Net;
using System.Net.Http;
using System.Net.Http.Headers;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ namespace Fixtures.AcceptanceTestsBodyNumber
using System;
using System.Linq;
using System.Collections.Generic;
using System.Globalization;
using System.Net;
using System.Net.Http;
using System.Net.Http.Headers;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ namespace Fixtures.AcceptanceTestsBodyString
using System;
using System.Linq;
using System.Collections.Generic;
using System.Globalization;
using System.Net;
using System.Net.Http;
using System.Net.Http.Headers;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ namespace Fixtures.AcceptanceTestsBodyString
using System;
using System.Linq;
using System.Collections.Generic;
using System.Globalization;
using System.Net;
using System.Net.Http;
using System.Net.Http.Headers;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ namespace Fixtures.AcceptanceTestsHeader
using System;
using System.Linq;
using System.Collections.Generic;
using System.Globalization;
using System.Net;
using System.Net.Http;
using System.Net.Http.Headers;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ namespace Fixtures.AcceptanceTestsHttp
using System;
using System.Linq;
using System.Collections.Generic;
using System.Globalization;
using System.Net;
using System.Net.Http;
using System.Net.Http.Headers;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ namespace Fixtures.AcceptanceTestsHttp
using System;
using System.Linq;
using System.Collections.Generic;
using System.Globalization;
using System.Net;
using System.Net.Http;
using System.Net.Http.Headers;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ namespace Fixtures.AcceptanceTestsHttp
using System;
using System.Linq;
using System.Collections.Generic;
using System.Globalization;
using System.Net;
using System.Net.Http;
using System.Net.Http.Headers;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ namespace Fixtures.AcceptanceTestsHttp
using System;
using System.Linq;
using System.Collections.Generic;
using System.Globalization;
using System.Net;
using System.Net.Http;
using System.Net.Http.Headers;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ namespace Fixtures.AcceptanceTestsHttp
using System;
using System.Linq;
using System.Collections.Generic;
using System.Globalization;
using System.Net;
using System.Net.Http;
using System.Net.Http.Headers;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ namespace Fixtures.AcceptanceTestsHttp
using System;
using System.Linq;
using System.Collections.Generic;
using System.Globalization;
using System.Net;
using System.Net.Http;
using System.Net.Http.Headers;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ namespace Fixtures.AcceptanceTestsHttp
using System;
using System.Linq;
using System.Collections.Generic;
using System.Globalization;
using System.Net;
using System.Net.Http;
using System.Net.Http.Headers;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ namespace Fixtures.AcceptanceTestsRequiredOptional
using System;
using System.Linq;
using System.Collections.Generic;
using System.Globalization;
using System.Net;
using System.Net.Http;
using System.Net.Http.Headers;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ namespace Fixtures.AcceptanceTestsRequiredOptional
using System;
using System.Linq;
using System.Collections.Generic;
using System.Globalization;
using System.Net;
using System.Net.Http;
using System.Net.Http.Headers;
Expand Down
Loading

0 comments on commit 2acb4ee

Please sign in to comment.