Example #1
0
            public void ReturnsFalseOnANewList()
            {
                var list = new DeletableObjectList <TestDeletable>();

                var returnValue = list.Remove(new TestDeletable());

                Assert.False(returnValue);
            }
Example #2
0
            public void ReturnsFalseOnANewList()
            {
                var list = new DeletableObjectList <TestDeletable>();

                var returnValue = list.Remove(new TestDeletable());

                returnValue.Should().BeFalse();
            }
Example #3
0
            public void IsAccurateWhenAddingAndRemoving(PositiveInt itemsToAdd, int randomSeed)
            {
                var itemCount = itemsToAdd.Get;
                var random    = new System.Random(randomSeed);
                var list      = new DeletableObjectList <TestDeletable>();

                foreach (var i in Enumerable.Range(1, itemCount))
                {
                    list.Add(new TestDeletable());
                    Assert.Equal(i, list.ApproximateCount);
                }

                foreach (var i in Enumerable.Range(1, itemCount))
                {
                    list.Remove(list.RandomElement(random));
                    Assert.Equal(itemCount - i, list.ApproximateCount);
                }
            }
Example #4
0
 protected override void CallMethod(DeletableObjectList <TestDeletable> list)
 => list.Remove(list.RandomElement(random));