public void FreezableCollection_FreezeThenAddThrows() { var sut = new FreezableCollection <int>(); sut.Add(1); sut.Freeze(); Assert.ThrowsAny <System.InvalidOperationException>(() => { sut.Add(2); }); }
public void FreezedList_002() { var collection = new FreezableCollection <int>(); collection.Add(1); collection.Add(2); var sut = FreezedList.AsFreezedList(collection); Assert.Equal(2, sut.Count); Assert.ThrowsAny <System.NotSupportedException>(() => { sut.Add(1); }); }
public void FreezableCollectionTest() { var sut = new FreezableCollection <int>(); Assert.Equal(0, sut.Count); sut.Add(1); Assert.Equal(1, sut.Count); sut.Add(2); Assert.Equal(2, sut.Count); sut.Freeze(); Assert.ThrowsAny <System.InvalidOperationException>(() => { sut.Add(3); }); Assert.Equal(2, sut.Count); }