public void Copy_Fail_ArrayT_SourceCountOutOfBounds() { var span = new TRexSpan <CellPass>(new CellPass[10], TRexSpan <CellPass> .NO_SLAB_INDEX, 5, 2, false); Action act = () => span.Copy(new CellPass[1], 3); act.Should().Throw <ArgumentException>().WithMessage("Source count may not be negative or greater than the count of elements in the source"); var span3 = new TRexSpan <CellPass>(new CellPass[10], TRexSpan <CellPass> .NO_SLAB_INDEX, 0, 1, false); act = () => span3.Copy(new CellPass[2], 2); act.Should().Throw <ArgumentException>().WithMessage("Target has insufficient capacity (1) to contain required items from source (2)"); }
public void Copy_Central() { var baseTime = DateTime.UtcNow; var span = new TRexSpan <CellPass>(new CellPass[12], TRexSpan <CellPass> .NO_SLAB_INDEX, 5, 2, false); var cp1 = new CellPass { Time = baseTime }; var cp2 = new CellPass { Time = baseTime.AddMinutes(1) }; span.Add(cp1); span.Add(cp2); var span2 = new TRexSpan <CellPass>(new CellPass[8], TRexSpan <CellPass> .NO_SLAB_INDEX, 0, 8, false); span2.Copy(span, 2); span2.Count.Should().Be(2); span2.GetElement(0).Should().BeEquivalentTo(cp1); span2.GetElement(1).Should().BeEquivalentTo(cp2); }