Skip to content

Commit

Permalink
Bug 300: Add test case for third parameter and fix error in postfix loop
Browse files Browse the repository at this point in the history
  • Loading branch information
sjmelia committed May 10, 2016
1 parent 3358bfe commit 059e68e
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions Swashbuckle.Core/Swagger/SwaggerGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@ private string GetUniqueFriendlyId(ApiDescription apiDesc, HashSet<string> opera
while (operationNames.Contains(friendlyId))
{
friendlyId = string.Format("{0}_{1}", apiDesc.FriendlyId(), nextFriendlyIdPostfix);
nextFriendlyIdPostfix++;
}
operationNames.Add(friendlyId);
return friendlyId;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,11 @@ public void GetAll(int id)
{
throw new NotImplementedException();
}

[Route("organisations/")]
public void GetAll(int id, string name)
{
throw new NotImplementedException();
}
}
}
2 changes: 2 additions & 0 deletions Swashbuckle.Tests/Swagger/CoreTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -556,8 +556,10 @@ public void It_handles_overloaded_attribute_routes()
var swagger = GetContent<JObject>("http://tempuri.org/swagger/docs/v1");
var firstGetOperation = swagger["paths"]["/subscriptions"]["get"];
var secondGetOperation = swagger["paths"]["/users"]["get"];
var thirdGetOperation = swagger["paths"]["/organisations"]["get"];
Assert.AreEqual("OverloadedAttributeRoutes_GetAll", firstGetOperation["operationId"].ToString());
Assert.AreEqual("OverloadedAttributeRoutes_GetAll_1", secondGetOperation["operationId"].ToString());
Assert.AreEqual("OverloadedAttributeRoutes_GetAll_2", thirdGetOperation["operationId"].ToString());
}

[Test]
Expand Down

0 comments on commit 059e68e

Please sign in to comment.