コード例 #1
0
        public void HasAmountOlderThan_NotEnough()
        {
            // only add two
            SimpleSnapshot a = new SimpleSnapshot(0, 0, 0);
            SimpleSnapshot b = new SimpleSnapshot(1, 1, 0);

            buffer.Add(a.remoteTimestamp, a);
            buffer.Add(b.remoteTimestamp, b);

            // shouldn't have more old enough than two
            // because we don't have more than two
            Assert.That(SnapshotInterpolation.HasAmountOlderThan(buffer, 0, 3), Is.False);
        }
コード例 #2
0
        public void HasAmountOlderThan_EnoughAndOldEnough()
        {
            // add three
            SimpleSnapshot a = new SimpleSnapshot(0, 0, 0);
            SimpleSnapshot b = new SimpleSnapshot(1, 1, 0);
            SimpleSnapshot c = new SimpleSnapshot(2, 2, 0);

            buffer.Add(a.remoteTimestamp, a);
            buffer.Add(b.remoteTimestamp, b);
            buffer.Add(c.remoteTimestamp, c);

            // check at time = 2.1, where third one would be old enough.
            Assert.That(SnapshotInterpolation.HasAmountOlderThan(buffer, 2.1, 3), Is.True);
        }