-
Notifications
You must be signed in to change notification settings - Fork 166
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(dpg): rename
top
parameter in pagination method (#2708)
- rename `top` parameter to `maxCount` if the name is not occupied - add test part of Azure/azure-sdk-for-net#29342
- Loading branch information
Showing
11 changed files
with
1,896 additions
and
41 deletions.
There are no files selected for viewing
64 changes: 32 additions & 32 deletions
64
samples/Azure.AI.DocumentTranslation/Generated/DocumentTranslationClient.cs
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
test/AutoRest.TestServerLowLevel.Tests/LowLevel/PaginationParameterOverwriteTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. | ||
|
||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Reflection; | ||
using NUnit.Framework; | ||
using PaginationParams_LowLevel; | ||
|
||
namespace AutoRest.TestServer.Tests | ||
{ | ||
public class PaginationParameterOverwriteTests | ||
{ | ||
[Test] | ||
public void OverwriteTop() | ||
{ | ||
Assert.AreEqual(new string[] { "maxCount", "skip", "maxpagesize", "context" }, GetMethodParameterNames("GetPaginationParamsAsync")); | ||
} | ||
|
||
[Test] | ||
public void NoOverwrite() | ||
{ | ||
Assert.AreEqual(new string[] { "limit", "offset", "maxpagesize", "context" }, GetMethodParameterNames("Get2sAsync")); | ||
} | ||
|
||
[Test] | ||
public void OverwriteTopCaseIncensitive() | ||
{ | ||
Assert.AreEqual(new string[] { "maxCount", "skip", "maxpagesize", "context" }, GetMethodParameterNames("Get3sAsync")); | ||
} | ||
|
||
[Test] | ||
public void NoOverwriteDueToOccupiedName() | ||
{ | ||
Assert.AreEqual(new string[] { "top", "skip", "maxcount", "context" }, GetMethodParameterNames("Get4sAsync")); | ||
} | ||
|
||
private static IReadOnlyList<string> GetMethodParameterNames(string methodName) | ||
{ | ||
var clazz = typeof(PaginationParamsClient); | ||
TypeAsserts.HasPublicInstanceMethod(clazz, methodName); | ||
var method = clazz.GetMethod(methodName, BindingFlags.Instance | BindingFlags.Public); | ||
return method.GetParameters().Select(p => p.Name).ToList(); | ||
} | ||
} | ||
} |
Oops, something went wrong.