示例#1
0
        public void TestReadOnly()
        {
            BTreeDictionary <int, string> data = new BTreeDictionary <int, string>(Comparer, GetSample());

            Assert.IsFalse(data.IsReadOnly);

            BTreeDictionary <int, string> copy = data.MakeReadOnly();

            Assert.IsFalse(ReferenceEquals(data, copy));
            Assert.AreEqual(data.Count, copy.Count);
            Assert.IsTrue(copy.IsReadOnly);

            Assert.IsTrue(ReferenceEquals(copy, copy.MakeReadOnly()));
            data = copy.Clone();
            Assert.IsFalse(data.IsReadOnly);
            Assert.IsFalse(ReferenceEquals(copy, data));
            Assert.AreEqual(data.Count, copy.Count);
        }