1
0
mirror of https://github.com/bitwarden/server.git synced 2025-06-30 15:42:48 -05:00

Revert filescoped (#2227)

* Revert "Add git blame entry (#2226)"

This reverts commit 239286737d.

* Revert "Turn on file scoped namespaces (#2225)"

This reverts commit 34fb4cca2a.
This commit is contained in:
Justin Baur
2022-08-29 15:53:48 -04:00
committed by GitHub
parent 239286737d
commit bae03feffe
1208 changed files with 74317 additions and 73126 deletions

View File

@ -1,44 +1,45 @@
namespace Bit.Test.Common.Helpers;
public static class TestCaseHelper
namespace Bit.Test.Common.Helpers
{
public static IEnumerable<IEnumerable<T>> GetCombinations<T>(params T[] items)
public static class TestCaseHelper
{
var count = Math.Pow(2, items.Length);
for (var i = 0; i < count; i++)
public static IEnumerable<IEnumerable<T>> GetCombinations<T>(params T[] items)
{
var str = Convert.ToString(i, 2).PadLeft(items.Length, '0');
List<T> combination = new();
for (var j = 0; j < str.Length; j++)
var count = Math.Pow(2, items.Length);
for (var i = 0; i < count; i++)
{
if (str[j] == '1')
var str = Convert.ToString(i, 2).PadLeft(items.Length, '0');
List<T> combination = new();
for (var j = 0; j < str.Length; j++)
{
combination.Add(items[j]);
if (str[j] == '1')
{
combination.Add(items[j]);
}
}
yield return combination;
}
yield return combination;
}
}
public static IEnumerable<IEnumerable<object>> GetCombinationsOfMultipleLists(params IEnumerable<object>[] optionLists)
{
if (!optionLists.Any())
{
yield break;
}
foreach (var item in optionLists.First())
public static IEnumerable<IEnumerable<object>> GetCombinationsOfMultipleLists(params IEnumerable<object>[] optionLists)
{
var itemArray = new[] { item };
if (optionLists.Length == 1)
if (!optionLists.Any())
{
yield return itemArray;
yield break;
}
foreach (var nextCombination in GetCombinationsOfMultipleLists(optionLists.Skip(1).ToArray()))
foreach (var item in optionLists.First())
{
yield return itemArray.Concat(nextCombination);
var itemArray = new[] { item };
if (optionLists.Length == 1)
{
yield return itemArray;
}
foreach (var nextCombination in GetCombinationsOfMultipleLists(optionLists.Skip(1).ToArray()))
{
yield return itemArray.Concat(nextCombination);
}
}
}
}