Exemple #1
0
        public void Insert_InMiddle()
        {
            var baseTime = DateTime.UtcNow;
            var span     = new TRexSpan <CellPass>(new CellPass[3], TRexSpan <CellPass> .NO_SLAB_INDEX, 0, 3, false);
            var cp1      = new CellPass
            {
                Time = baseTime
            };
            var cp2 = new CellPass
            {
                Time = baseTime.AddMinutes(1)
            };

            span.Add(cp1);
            span.Add(cp1);
            span.Insert(cp2, 1);

            span.Count.Should().Be(3);
            span.First().Should().BeEquivalentTo(cp1);
            span.Last().Should().BeEquivalentTo(cp1);

            span.GetElement(0).Should().BeEquivalentTo(cp1);
            span.GetElement(1).Should().BeEquivalentTo(cp2);

            span.OffsetPlusCount.Should().Be(3);
        }
Exemple #2
0
        public void Add_SimpleSpanTwo()
        {
            var baseTime = DateTime.UtcNow;
            var span     = new TRexSpan <CellPass>(new CellPass[2], TRexSpan <CellPass> .NO_SLAB_INDEX, 0, 2, false);
            var cp1      = new CellPass
            {
                Time = baseTime
            };
            var cp2 = new CellPass
            {
                Time = baseTime.AddMinutes(1)
            };

            span.Add(cp1);
            span.Add(cp2);

            span.Count.Should().Be(2);
            span.First().Should().BeEquivalentTo(cp1);
            span.Last().Should().BeEquivalentTo(cp2);

            span.GetElement(0).Should().BeEquivalentTo(cp1);
            span.GetElement(1).Should().BeEquivalentTo(cp2);

            span.OffsetPlusCount.Should().Be(2);
        }
Exemple #3
0
        public void Add_CentralSpanTwo(int poolSize, ushort spanOffset, int spanCapacity)
        {
            var baseTime = DateTime.UtcNow;
            var span     = new TRexSpan <CellPass>(new CellPass[poolSize], TRexSpan <CellPass> .NO_SLAB_INDEX, spanOffset, spanCapacity, false);
            var cp1      = new CellPass
            {
                Time = baseTime
            };
            var cp2 = new CellPass
            {
                Time = baseTime.AddMinutes(1)
            };

            span.Add(cp1);
            span.Add(cp2);

            span.Count.Should().Be(2);
            span.First().Should().BeEquivalentTo(cp1);
            span.Last().Should().BeEquivalentTo(cp2);

            span.GetElement(0).Should().BeEquivalentTo(cp1);
            span.GetElement(1).Should().BeEquivalentTo(cp2);

            span.OffsetPlusCount.Should().Be(spanOffset + span.Count);
        }