Ejemplo n.º 1
0
        public void Setup2()
        {
            _scheduler        = new ManualTaskScheduler();
            _source           = new Mock <ILogSource>();
            _listeners        = new LogSourceListenerCollection(_source.Object);
            _sourceEntries    = new LogBufferList(Core.Columns.Index, Core.Columns.LogLevel, Core.Columns.Timestamp);
            _sourceProperties = new PropertiesBufferList();
            _source.Setup(x => x.GetAllProperties(It.IsAny <IPropertiesBuffer>()))
            .Callback((IPropertiesBuffer destination) => _sourceProperties.CopyAllValuesTo(destination));
            _source.Setup(x => x.GetProperty(It.IsAny <IPropertyDescriptor>()))
            .Returns((IPropertyDescriptor property) => _sourceProperties.GetValue(property));

            _source.Setup(x => x.Columns).Returns(() => _sourceEntries.Columns);
            _source.Setup(x => x.AddListener(It.IsAny <ILogSourceListener>(), It.IsAny <TimeSpan>(), It.IsAny <int>()))
            .Callback((ILogSourceListener listener, TimeSpan maximumWaitTime, int maximumLineCount) =>
            {
                _listeners.AddListener(listener, maximumWaitTime, maximumLineCount);
            });
            _source.Setup(x => x.RemoveListener(It.IsAny <ILogSourceListener>()))
            .Callback((ILogSourceListener listener) =>
            {
                _listeners.RemoveListener(listener);
            });
            _source.Setup(x => x.GetEntries(It.IsAny <IReadOnlyList <LogLineIndex> >(), It.IsAny <ILogBuffer>(),
                                            It.IsAny <int>(), It.IsAny <LogSourceQueryOptions>()))
            .Callback((IReadOnlyList <LogLineIndex> sourceIndices, ILogBuffer destination, int destinationIndex, LogSourceQueryOptions queryOptions) =>
            {
                _sourceEntries.CopyTo(new Int32View(sourceIndices), destination, destinationIndex);
            });
        }
Ejemplo n.º 2
0
 public override void GetColumn <T>(IReadOnlyList <LogLineIndex> sourceIndices, IColumnDescriptor <T> column, T[] destination, int destinationIndex, LogSourceQueryOptions queryOptions)
 {
     if (IsIndexedColumn(column))
     {
         _indices.CopyTo(column, new Int32View(sourceIndices), destination, destinationIndex);
     }
     else
     {
         _source.GetColumn(sourceIndices, column, destination, destinationIndex, queryOptions);
     }
 }