public void Setup() { mockList = Substitute.For <IList <int> >(); mockBaseList = Substitute.For <IBaseListCollection <int> >(); mockRegistryStorage = Substitute.For <IRegistryStorage>(); mockLogEntry = Substitute.For <ILogEntry>(); }
public void Setup() { mockRegistryStorage = Substitute.For <IRegistryStorage>(); mockLogEntry = Substitute.For <ILogEntry>(); mockLogEntry.IsValid.ReturnsForAnyArgs(true); }
public ILogRegistry Create(RegistrySelectionCriteria criteria) { creationCounter.Increment(criteria.ToString()); IRegistryStorage storage = PickStorage(criteria); return(new LogRegistry(storage)); }
/// <summary> /// Create a LogRegistry. /// </summary> /// <param name="storage">The actual storage object that will hold all log entries.</param> public LogRegistry(IRegistryStorage storage) { if (storage == null) { throw new ArgumentNullException(nameof(storage)); } if (storage.SortAttribute != LogAttribute.Timestamp) { throw new ArgumentException("Storage must sort logs by Timestamp", nameof(storage)); } this.storage = storage; this.LogScheduler = TaskPoolScheduler.Default; }
private readonly ExpressionMethodVisitor <int> metricCollector = new ExpressionMethodVisitor <int>(); // Can't be static in-case async operation is used. Hopefully evaluate is never invoked async. public ListStorageEvaluator(IRegistryStorage storage, IBaseListCollection <ILogEntry> data) { this.dataRegistryStorage = storage; this.data = data; this.metricCollector.MethodVisitHandler = (mexp, d, unused, visit) => { var method = mexp.Method; if (method.IsGenericMethod) { method = method.GetGenericMethodDefinition(); } expressionMethodCounter.Increment(method.ToString()); visit(mexp.Arguments[0]); return(mexp); }; }