public void CopyToTest3()
    {
        int[] innerArr   = Enumerable.Range(0, 10).ToArray();
        int[] map        = new int[] { 5, 3, 8, 0, 9 };
        var   mappingVec = new MappingVector <int>(innerArr, map);

        int[] tgtArr = new int[12];
        mappingVec.CopyTo(tgtArr, 2, 1, 2);

        // Test the segment yields the expected values.
        int[] expectedArr = new int[] { 0, 0, 3, 8, 0, 0, 0, 0, 0, 0, 0, 0 };
        Assert.Equal(expectedArr, tgtArr);
    }
    public void CopyToTest_InvalidCopyOperations()
    {
        int[] innerArr   = Enumerable.Range(0, 10).ToArray();
        int[] map        = new int[] { 5, 3, 8 };
        var   mappingVec = new MappingVector <int>(innerArr, map);

        int[] tgtArr = new int[12];

        //--- Two param tests.
        // Copy beyond end of tgtArr.
        Assert.Throws <ArgumentException>(() => mappingVec.CopyTo(tgtArr, 10));

        // Invalid target index.
        Assert.Throws <ArgumentException>(() => mappingVec.CopyTo(tgtArr, -1));

        //--- Three param tests.
        // Copy length longer then vecSeg length.
        Assert.Throws <ArgumentException>(() => mappingVec.CopyTo(tgtArr, 0, 4));

        // Invalid target index.
        Assert.Throws <ArgumentException>(() => mappingVec.CopyTo(tgtArr, -1, 1));

        // Invalid length.
        Assert.Throws <ArgumentException>(() => mappingVec.CopyTo(tgtArr, 0, -1));

        // Copy beyond end of tgtArr.
        Assert.Throws <ArgumentException>(() => mappingVec.CopyTo(tgtArr, 11, 2));
        Assert.Throws <ArgumentException>(() => mappingVec.CopyTo(tgtArr, 12, 1));

        //--- Four param tests.
        // Copy beyond end of vecSeg.
        Assert.Throws <ArgumentException>(() => mappingVec.CopyTo(tgtArr, 0, 1, 3));

        // Copy beyond end of tgtArr.
        Assert.Throws <ArgumentException>(() => mappingVec.CopyTo(tgtArr, 11, 1, 2));
        Assert.Throws <ArgumentException>(() => mappingVec.CopyTo(tgtArr, 12, 1, 1));

        // Invalid source and target indexes.
        Assert.Throws <ArgumentException>(() => mappingVec.CopyTo(tgtArr, -1, 0, 1));
        Assert.Throws <ArgumentException>(() => mappingVec.CopyTo(tgtArr, 0, -1, 1));

        // Invalid length.
        Assert.Throws <ArgumentException>(() => mappingVec.CopyTo(tgtArr, 0, 1, -1));
    }