Esempio n. 1
0
        public void TestSetup()
        {
            factory = Substitute.For <IStreamStateFactory>();
            factory.Create(Arg.Any <string>()).Returns(_ => state);

            state = Substitute.For <IStreamState>();
            state.BufferPool.Returns(_ => pool);
            state.Statistics.Returns(_ => stats);
            state.RecordWriter.Returns(_ => writer);
            state.SendSignal.Returns(new AsyncManualResetEvent(false));

            buffer = Substitute.For <IBuffer>();
            writer = Substitute.For <IRecordWriter>();
            stats  = Substitute.For <IStatisticsCollector>();
            daemon = Substitute.For <IDaemon>();

            pool = Substitute.For <IBufferPool>();
            pool.TryAcquire(out _)
            .Returns(
                info =>
            {
                info[0] = buffer;
                return(true);
            });

            log = new SynchronousConsoleLog();

            sink = new HerculesSink(factory, daemon, log);
        }
Esempio n. 2
0
 internal HerculesSink(IStreamStateFactory streamStateFactory, IDaemon daemon, ILog log)
 {
     state = new State(streamStateFactory, daemon, log, new ConcurrentDictionary <string, Lazy <IStreamState> >());
 }