示例#1
0
        public void SetByIndex()
        {
            Assert.Throws <ArgumentOutOfRangeException>(() =>
                                                        _dictionary.SetByIndex(-1, "new fourth value"));
            Assert.Throws <ArgumentOutOfRangeException>(() =>
                                                        _dictionary.SetByIndex(3, "new fourth value"));
            Assert.Throws <NotSupportedException>(() => _readOnly.SetByIndex(0, "new first value"));

            _dictionary.SetByIndex(0, "new first value");
            Assert.AreEqual("one", _dictionary.GetKey(0));
            Assert.AreEqual(new CloneableType("new first value"), _dictionary.GetByIndex(0));
        }