Ejemplo n.º 1
0
 public void Setup()
 {
     mockList            = Substitute.For <IList <int> >();
     mockBaseList        = Substitute.For <IBaseListCollection <int> >();
     mockRegistryStorage = Substitute.For <IRegistryStorage>();
     mockLogEntry        = Substitute.For <ILogEntry>();
 }
Ejemplo n.º 2
0
        public void Setup()
        {
            mockRegistryStorage = Substitute.For <IRegistryStorage>();
            mockLogEntry        = Substitute.For <ILogEntry>();

            mockLogEntry.IsValid.ReturnsForAnyArgs(true);
        }
Ejemplo n.º 3
0
            public ILogRegistry Create(RegistrySelectionCriteria criteria)
            {
                creationCounter.Increment(criteria.ToString());

                IRegistryStorage storage = PickStorage(criteria);

                return(new LogRegistry(storage));
            }
Ejemplo n.º 4
0
 /// <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;
 }
Ejemplo n.º 5
0
        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);
            };
        }