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

This enables the Notification Center created global notifications to be sent to affected devices of the same server installation. All clients connected to any of the server instance of that installation id would receive it. This is useful for notifying all clients of an installation about upcoming maintenance. This works both for Self-Hosted, but also for Cloud, assuming an installation id is set.
63 lines
1.8 KiB
C#
63 lines
1.8 KiB
C#
using System.Reflection;
|
|
|
|
namespace Bit.Test.Common.AutoFixture.Attributes;
|
|
|
|
public class RepeatingPatternBitAutoDataAttribute : BitAutoDataAttribute
|
|
{
|
|
private readonly List<object[]> _repeatingDataList;
|
|
|
|
public RepeatingPatternBitAutoDataAttribute(object[] first)
|
|
{
|
|
_repeatingDataList = AllValues([first]);
|
|
}
|
|
|
|
public RepeatingPatternBitAutoDataAttribute(object[] first, object[] second)
|
|
{
|
|
_repeatingDataList = AllValues([first, second]);
|
|
}
|
|
|
|
public RepeatingPatternBitAutoDataAttribute(object[] first, object[] second, object[] third)
|
|
{
|
|
_repeatingDataList = AllValues([first, second, third]);
|
|
}
|
|
|
|
public override IEnumerable<object[]> GetData(MethodInfo testMethod)
|
|
{
|
|
foreach (var repeatingData in _repeatingDataList)
|
|
{
|
|
var bitData = base.GetData(testMethod).First();
|
|
for (var i = 0; i < repeatingData.Length; i++)
|
|
{
|
|
bitData[i] = repeatingData[i];
|
|
}
|
|
|
|
yield return bitData;
|
|
}
|
|
}
|
|
|
|
private static List<object[]> AllValues(object[][] parameterToPatternValues)
|
|
{
|
|
var result = new List<object[]>();
|
|
GenerateCombinations(parameterToPatternValues, new object[parameterToPatternValues.Length], 0, result);
|
|
return result;
|
|
}
|
|
|
|
private static void GenerateCombinations(object[][] parameterToPatternValues, object[] current, int index,
|
|
List<object[]> result)
|
|
{
|
|
if (index == current.Length)
|
|
{
|
|
result.Add((object[])current.Clone());
|
|
return;
|
|
}
|
|
|
|
var patternValues = parameterToPatternValues[index];
|
|
|
|
foreach (var value in patternValues)
|
|
{
|
|
current[index] = value;
|
|
GenerateCombinations(parameterToPatternValues, current, index + 1, result);
|
|
}
|
|
}
|
|
}
|