Пример #1
0
        public void Reached_SecondPacketIsNonDataPacket_BarrierIsNotReached()
        {
            var barrier      = new PacketBarrier(TimeFrame);
            var firstPacket  = CreateDataPacket(TimeSpan.FromSeconds(2));
            var secondPacket = CreateNonDataPacket(TimeSpan.FromSeconds(3));

            barrier.PacketPushed(firstPacket);
            barrier.PacketPushed(secondPacket);

            Assert.That(barrier.Reached(), Is.False);
        }
Пример #2
0
        public void TimeToNextFrame_CalledWhenBarrierIsReached_ReturnsPositiveTime()
        {
            var barrier = new PacketBarrier(TimeFrame);

            var firstPacket  = CreateDataPacket(TimeSpan.FromSeconds(2));
            var secondPacket = CreateDataPacket(TimeSpan.FromSeconds(3));

            barrier.PacketPushed(firstPacket);
            barrier.PacketPushed(secondPacket);

            Assert.That(barrier.TimeToNextFrame(), Is.GreaterThan(TimeSpan.Zero));
        }
Пример #3
0
        public void Reset_CalledAfterBarrierIsReached_ResetsBarrier()
        {
            var barrier = new PacketBarrier(TimeFrame);

            var firstPacket  = CreateDataPacket(TimeSpan.FromSeconds(2));
            var secondPacket = CreateDataPacket(TimeSpan.FromSeconds(3));

            barrier.PacketPushed(firstPacket);
            barrier.PacketPushed(secondPacket);

            barrier.Reset();

            Assert.That(barrier.Reached(), Is.False);
        }