/
vshmidt
/
masstransit
Обзор
Документация
Войти
/
vshmidt
/
masstransit
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
develop
src/MassTransit/Testing/FilterSet.cs
51 строка
1 KB
Chris Patterson
Rewrote Testing Received/Consumed/Published/Saga lists to support asynchronous awaits
20 май 2020, 00:53
20 май 2020, 00:53
5197208
Код
Авторство
О чём код?
namespace MassTransit.Testing { using System.Collections.Generic; using System.Linq; public class FilterSet<T> where T : class { readonly List<FilterDelegate<T>> _list; FilterDelegate<T> _all = x => true; FilterDelegate<T> _any = x => true; FilterDelegate<T> _notAny = x => false; protected FilterSet() { _list = new List<FilterDelegate<T>>(); } protected FilterSet<T> Add(FilterDelegate<T> filter) { _all = x => _list.All(predicate => predicate(x)); _any = x => _list.Any(predicate => predicate(x)); _notAny = x => !_any(x); _list.Add(filter); return this; } public bool All(T target) { return _all(target); } public bool Any(T target) { return _any(target); } public bool NotAny(T target) { return _notAny(target); } public bool None(T target) { return _list.Count == 0 || !_any(target); } } }