示例#1
0
        public void TestReadOnlyOffsetMapWithOverlap()
        {
            List <int> list = new List <int> {
                1, 2, 3, 4
            };
            IReadOnlyList <int> map = new ReadOnlyOffsetMap <int>(list)
            {
                new Mapping(1, 1),
                new Mapping(0, 3),
            };

            Assert.AreEqual(4, map.Count);
            CollectionAssert.AreEqual(new[] { 2, 1, 2, 3 }, (ICollection)map);
            Assert.AreEqual(2, map[0]);
            Assert.AreEqual(1, map[1]);
        }
示例#2
0
        public void TestReadOnlyOffsetMapWithOverlap()
        {
            List<int> list = new List<int> { 1, 2, 3, 4 };
            IReadOnlyList<int> map = new ReadOnlyOffsetMap<int>(list)
            {
                new Mapping(1, 1),
                new Mapping(0, 3),
            };

            Assert.AreEqual(4, map.Count);
            CollectionAssert.AreEqual(new[] { 2, 1, 2, 3 }, (ICollection)map);
            Assert.AreEqual(2, map[0]);
            Assert.AreEqual(1, map[1]);
        }