Beispiel #1
0
        public void FreezableDictionary_FreezeThenAddThrows()
        {
            var sut = new FreezableDictionary <int, int>();

            Assert.Equal(0, sut.Count);
            sut.Add(1, 1);
            Assert.Equal(1, sut.Count);
            sut.Freeze();
            Assert.ThrowsAny <System.InvalidOperationException>(() => {
                sut.Add(2, 2);
            });
        }
Beispiel #2
0
        public void FreezableDictionaryTest()
        {
            var sut = new FreezableDictionary <int, int>();

            Assert.Equal(0, sut.Count);
            sut.Add(1, 1);
            sut.Add(2, 2);
            Assert.Equal(2, sut.Count);
            sut.Freeze();
            Assert.Throws <System.InvalidOperationException>(() => sut.Add(3, 3));
            Assert.Equal(2, sut.Count);
        }