コード例 #1
0
        public void ShouldAddWhileRunning()
        {
            var ringBuffer = RingBuffer<TestEvent>.CreateSingleProducer(()=>new TestEvent(), 32);
            var sequenceThree = new Sequence(3L);
            var sequenceSeven = new Sequence(7L);
            var sequenceGroup = new SequenceGroup();
            sequenceGroup.Add(sequenceSeven);

            for (var i = 0; i < 11; i++)
            {
                ringBuffer.Publish(ringBuffer.Next());
            }

            sequenceGroup.AddWhileRunning(ringBuffer, sequenceThree);
            Assert.That(sequenceThree.Value, Is.EqualTo(10L));
        }
コード例 #2
0
    public void ShouldAddWhileRunning()
    {
        var ringBuffer = RingBuffer <TestEvent> .CreateSingleProducer(() => new TestEvent(), 32);

        var sequenceThree = new Sequence(3L);
        var sequenceSeven = new Sequence(7L);
        var sequenceGroup = new SequenceGroup();

        sequenceGroup.Add(sequenceSeven);

        for (var i = 0; i < 11; i++)
        {
            ringBuffer.Publish(ringBuffer.Next());
        }

        sequenceGroup.AddWhileRunning(ringBuffer, sequenceThree);
        Assert.That(sequenceThree.Value, Is.EqualTo(10L));
    }
コード例 #3
0
        public void ShouldAddWhileRunning()
        {
            var ringBuffer = RingBuffer <TestEvent> .CreateSingleProducer(new TestEventFactory(), 32);

            var sequenceThree = new Sequence(3L);
            var sequenceSeven = new Sequence(7L);
            var sequenceGroup = new SequenceGroup();

            sequenceGroup.Add(sequenceSeven);

            for (int i = 0; i < 11; i++)
            {
                ringBuffer.Publish(ringBuffer.Next());
            }

            sequenceGroup.AddWhileRunning(ringBuffer, sequenceThree);
            Assert.Equal(10L, sequenceThree.GetValue());
        }