Beispiel #1
0
        public void Add_Locked_IsAdded()
        {
            //arrange
            var set = new SnapshotSet <int>(10);

            set.GetSnapShot();

            //act
            set.Add(42);
            set.Release();

            //assert
            var snapshot = set.GetSnapShot();

            Assert.That(snapshot[0], Is.EqualTo(42));
        }
Beispiel #2
0
        public void Remove_Locked_IsRemoved()
        {
            //arrange
            var set = new SnapshotSet <int>(10);

            set.Add(1);
            set.Add(2);
            set.Add(3);
            set.GetSnapShot();

            //act
            set.Remove(2);
            set.Release();

            //assert
            var snapshot = set.GetSnapShot();

            Assert.That(snapshot[0], Is.EqualTo(1));
            Assert.That(snapshot[1], Is.EqualTo(3));
            Assert.That(snapshot.Length, Is.EqualTo(2));
        }