mirror of
https://github.com/bitwarden/server.git
synced 2025-06-30 15:42:48 -05:00
[EC-315] Record user IP and device type for OrgUser and ProviderUser events (#2119)
This commit is contained in:
@ -64,6 +64,28 @@ namespace Bit.Test.Common.Helpers
|
||||
public static Expression<Predicate<T>> AssertPropertyEqual<T>(T expected, params string[] excludedPropertyStrings) =>
|
||||
(T actual) => AssertPropertyEqualPredicate(expected, excludedPropertyStrings)(actual);
|
||||
|
||||
private static Predicate<IEnumerable<T>> AssertPropertyEqualPredicate<T>(IEnumerable<T> expected, params string[] excludedPropertyStrings) => (actual) =>
|
||||
{
|
||||
// IEnumerable.Zip doesn't account for different lengths, we need to check this ourselves
|
||||
if (actual.Count() != expected.Count())
|
||||
{
|
||||
throw new Exception(string.Concat($"Actual IEnumerable does not have the expected length.\n",
|
||||
$"Expected: {expected.Count()}\n",
|
||||
$"Actual: {actual.Count()}"));
|
||||
}
|
||||
|
||||
var elements = expected.Zip(actual);
|
||||
foreach (var (expectedEl, actualEl) in elements)
|
||||
{
|
||||
AssertPropertyEqual(expectedEl, actualEl, excludedPropertyStrings);
|
||||
}
|
||||
|
||||
return true;
|
||||
};
|
||||
|
||||
public static Expression<Predicate<IEnumerable<T>>> AssertPropertyEqual<T>(IEnumerable<T> expected, params string[] excludedPropertyStrings) =>
|
||||
(actual) => AssertPropertyEqualPredicate(expected, excludedPropertyStrings)(actual);
|
||||
|
||||
private static Predicate<T> AssertEqualExpectedPredicate<T>(T expected) => (actual) =>
|
||||
{
|
||||
Assert.Equal(expected, actual);
|
||||
|
Reference in New Issue
Block a user