Skip to content

Commit

Permalink
Merge branch 'feature/v3' of https://github.com/Azure/autorest.csharp
Browse files Browse the repository at this point in the history
…into getAllModels

* 'feature/v3' of https://github.com/Azure/autorest.csharp:
  fix(dpg): same type property only mock once (#3633)
  • Loading branch information
iscai-msft committed Aug 3, 2023
2 parents 0e4402d + cfef727 commit 46a240c
Show file tree
Hide file tree
Showing 13 changed files with 1,318 additions and 672 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -286,9 +286,35 @@ var data = new {
description = "<description>",
disabled = true,
disableRecursiveReplacerApplication = true,
doNotReplaceRegex = new {
maxDigits = 1234,
maxLetters = 1234,
minDashes = 1234,
minDigits = 1234,
minDigitsOrLetters = 1234,
minDots = 1234,
minHex = 1234,
minLetters = 1234,
minUnderscores = 1234,
options = 1234,
regexStr = "<regexStr>",
},
lastUpdatedTimestamp = 1234L,
modifiedBy = "<modifiedBy>",
name = "<name>",
regex = new {
maxDigits = 1234,
maxLetters = 1234,
minDashes = 1234,
minDigits = 1234,
minDigitsOrLetters = 1234,
minDots = 1234,
minHex = 1234,
minLetters = 1234,
minUnderscores = 1234,
options = 1234,
regexStr = "<regexStr>",
},
replaceWith = "<replaceWith>",
}
},
Expand Down Expand Up @@ -499,9 +525,35 @@ var data = new {
description = "<description>",
disabled = true,
disableRecursiveReplacerApplication = true,
doNotReplaceRegex = new {
maxDigits = 1234,
maxLetters = 1234,
minDashes = 1234,
minDigits = 1234,
minDigitsOrLetters = 1234,
minDots = 1234,
minHex = 1234,
minLetters = 1234,
minUnderscores = 1234,
options = 1234,
regexStr = "<regexStr>",
},
lastUpdatedTimestamp = 1234L,
modifiedBy = "<modifiedBy>",
name = "<name>",
regex = new {
maxDigits = 1234,
maxLetters = 1234,
minDashes = 1234,
minDigits = 1234,
minDigitsOrLetters = 1234,
minDots = 1234,
minHex = 1234,
minLetters = 1234,
minUnderscores = 1234,
options = 1234,
regexStr = "<regexStr>",
},
replaceWith = "<replaceWith>",
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -336,9 +336,35 @@ public void Example_CreateOrUpdateResourceSetRule_AllParameters()
description = "<description>",
disabled = true,
disableRecursiveReplacerApplication = true,
doNotReplaceRegex = new {
maxDigits = 1234,
maxLetters = 1234,
minDashes = 1234,
minDigits = 1234,
minDigitsOrLetters = 1234,
minDots = 1234,
minHex = 1234,
minLetters = 1234,
minUnderscores = 1234,
options = 1234,
regexStr = "<regexStr>",
},
lastUpdatedTimestamp = 1234L,
modifiedBy = "<modifiedBy>",
name = "<name>",
regex = new {
maxDigits = 1234,
maxLetters = 1234,
minDashes = 1234,
minDigits = 1234,
minDigitsOrLetters = 1234,
minDots = 1234,
minHex = 1234,
minLetters = 1234,
minUnderscores = 1234,
options = 1234,
regexStr = "<regexStr>",
},
replaceWith = "<replaceWith>",
}
},
Expand Down Expand Up @@ -554,9 +580,35 @@ public async Task Example_CreateOrUpdateResourceSetRule_AllParameters_Async()
description = "<description>",
disabled = true,
disableRecursiveReplacerApplication = true,
doNotReplaceRegex = new {
maxDigits = 1234,
maxLetters = 1234,
minDashes = 1234,
minDigits = 1234,
minDigitsOrLetters = 1234,
minDots = 1234,
minHex = 1234,
minLetters = 1234,
minUnderscores = 1234,
options = 1234,
regexStr = "<regexStr>",
},
lastUpdatedTimestamp = 1234L,
modifiedBy = "<modifiedBy>",
name = "<name>",
regex = new {
maxDigits = 1234,
maxLetters = 1234,
minDashes = 1234,
minDigits = 1234,
minDigitsOrLetters = 1234,
minDots = 1234,
minHex = 1234,
minLetters = 1234,
minUnderscores = 1234,
options = 1234,
regexStr = "<regexStr>",
},
replaceWith = "<replaceWith>",
}
},
Expand Down
31 changes: 31 additions & 0 deletions src/AutoRest.CSharp/Common/Utilities/HashSetExtensions.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using AutoRest.CSharp.Utilities;

namespace AutoRest.CSharp.Common.Utilities
{
internal static class HashSetExtensions
{
/// <summary>
/// Push an item into the set, which will be popped later when the returned <see cref="IDisposable"/> is disposed.
/// </summary>
/// <typeparam name="T"><see cref="HashSet{T}">HashSet</see> item</typeparam>
/// <param name="hashSet"></param>
/// <param name="item">Item to push</param>
/// <returns></returns>
internal static IDisposable Push<T>(this HashSet<T> hashSet, T item)
{
hashSet.Add(item);
return Disposable.Create(() =>
{
hashSet.Remove(item);
});
}
}
}
Loading

0 comments on commit 46a240c

Please sign in to comment.