Пример #1
0
        public void SetElement_Empty_Fail()
        {
            var    span = new TRexSpan <CellPass>(new CellPass[3], TRexSpan <CellPass> .NO_SLAB_INDEX, 0, 3, false);
            Action act  = () => span.SetElement(new CellPass(), 0);

            act.Should().Throw <ArgumentException>("Index out of range");
        }
Пример #2
0
        public void SetElement_SingleElement_RangeFailure()
        {
            var baseTime = DateTime.UtcNow;
            var span     = new TRexSpan <CellPass>(new CellPass[3], TRexSpan <CellPass> .NO_SLAB_INDEX, 0, 3, false);

            var cp = new CellPass
            {
                Time = baseTime
            };

            span.Add(cp);

            Action act = () => span.SetElement(cp, -1);

            act.Should().Throw <ArgumentException>("Index out of range");

            act = () => span.SetElement(cp, 1);
            act.Should().Throw <ArgumentException>("Index out of range");
        }
Пример #3
0
        public void SetElement_SingleElement_Success()
        {
            var baseTime = DateTime.UtcNow;
            var span     = new TRexSpan <CellPass>(new CellPass[3], TRexSpan <CellPass> .NO_SLAB_INDEX, 0, 3, false);

            var cp = new CellPass
            {
                Time = baseTime
            };
            var cp2 = new CellPass
            {
                Time = baseTime.AddMinutes(1)
            };

            span.Add(cp);
            span.SetElement(cp2, 0);

            span.GetElement(0).Should().BeEquivalentTo(cp2);
        }