public void TestRangeBasedAdd2()
        {
            IndexMap map = new IndexMap.RangeBased();

            map = map.Add(0, 1);
            map = map.Add(1, 2);
            Assert.IsInstanceOf <IndexMap.RangeBased>(map);
            Assert.AreEqual(1, map.Map(0));
            Assert.AreEqual(2, map.Map(1));
            Assert.Throws <KeyNotFoundException>(() => map.Map(2));
        }
        public void TestMixedWith1Then1()
        {
            IndexMap map = new IndexMap.RangeBased();

            map = map.Add(0, 1);
            Assert.IsInstanceOf <IndexMap.RangeBased>(map);
            map = map.Add(1, 3);
            Assert.IsInstanceOf <IndexMap.DictionaryBased>(map);
            Assert.AreEqual(1, map.Map(0));
            Assert.AreEqual(3, map.Map(1));
            Assert.Throws <KeyNotFoundException>(() => map.Map(2));
        }
Ejemplo n.º 3
0
        public void TestMixedWith2Then1()
        {
            IndexMap map = new IndexMap.RangeBased();

            map = map.Add(0, 1);
            map = map.Add(1, 2);
            Assert.IsType <IndexMap.RangeBased>(map);
            map = map.Add(2, 4);
            Assert.IsType <IndexMap.DictionaryBased>(map);
            Assert.Equal(1, map.Map(0));
            Assert.Equal(2, map.Map(1));
            Assert.Equal(4, map.Map(2));
            Assert.Throws <KeyNotFoundException>(() => map.Map(3));
        }
Ejemplo n.º 4
0
        public void TestRangeBasedAdd1()
        {
            IndexMap map = new IndexMap.RangeBased();

            map = map.Add(0, 1);
            Assert.IsType <IndexMap.RangeBased>(map);
            Assert.Equal(1, map.Map(0));
            Assert.Throws <KeyNotFoundException>(() => map.Map(1));
        }