public static void Add(this IItemChecker checker, params int[] ids) { foreach (var id in ids) { checker.Add(id); } }
public void Initialize() { _fieldDict = new Dictionary<FieldType, string>(); _checker = new DefaultItemChecker(); _checkerDict = new Dictionary<Item.ItemType, IItemChecker>(); _checkerDict.Add(Item.ItemType.Book, new DefaultItemChecker()); _iv = new ItemValidator(_checkerDict); }
/// <summary> /// Constructs a new ItemValidator. /// </summary> /// <param name="checkers"> /// A dictionary of field checkers per item type. /// If a checker for an item type is not specified, <see cref="DefaultItemChecker"/> is used. /// </param> /// <param name="defaultChecker">The <see cref="IItemChecker"/> implementation to use as default</param> public ItemValidator(IItemChecker defaultChecker = null, IDictionary <Item.ItemType, IItemChecker> checkers = null) { _checkers = checkers ?? new Dictionary <Item.ItemType, IItemChecker>(); _defaultChecker = defaultChecker ?? new DefaultItemChecker(); }