コード例 #1
0
        public void EventsLost_should_return_sum_of_events_lost_in_each_single_file_muxer()
        {
            var muxer1    = Substitute.For <ISingleFileMuxer>();
            var muxer2    = Substitute.For <ISingleFileMuxer>();
            var settings1 = new FileLogSettings();
            var settings2 = new FileLogSettings();

            singleMuxerFactory.Create(settings1).Returns(muxer1);
            singleMuxerFactory.Create(settings2).Returns(muxer2);
            muxer1.EventsLost.Returns(2);
            muxer2.EventsLost.Returns(3);

            Register("log1", settings1);
            Register("log2", settings2);

            muxer.EventsLost.Should().Be(5);
        }
コード例 #2
0
        public void TestSetup()
        {
            flushBlocker = new TaskCompletionSource <bool>();

            singleFileMuxer = Substitute.For <ISingleFileMuxer>();
            singleFileMuxer.TryAdd(Arg.Any <LogEventInfo>(), Arg.Any <bool>()).Returns(true);
            singleFileMuxer.FlushAsync().Returns(flushBlocker.Task);

            singleMuxerFactory = Substitute.For <ISingleFileMuxerFactory>();
            singleMuxerFactory.Create(Arg.Any <FileLogSettings>()).Returns(singleFileMuxer);

            muxer = new MultiFileMuxer(singleMuxerFactory);
        }