Ejemplo n.º 1
0
        public void NullListParameterUsePredicate()
        {
            //Arrange
            var listOriginal = default(List <Int32>);
            var listToAdd    = new List <Int32>();

            //Act
            CollectionHelpers.AddRangeIfNotExists(listOriginal, (alreadyPresent, toAdd) => alreadyPresent == toAdd, listToAdd);

            //Assert
            Assert.Fail();
        }
Ejemplo n.º 2
0
        public void NullPredicateParameterUsePredicate()
        {
            //Arrange
            var listOriginal = new List <Int32>();
            var listToAdd    = new List <Int32>();

            //Act
            CollectionHelpers.AddRangeIfNotExists(listOriginal, null, listToAdd);

            //Assert
            Assert.Fail();
        }
Ejemplo n.º 3
0
        public void NormalUsePredicate()
        {
            //Arrange
            var         listOriginal   = new List <Int32>(new[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 });
            var         listToAdd      = new List <Int32>(new[] { 1, 2, 3, 4, 5 });
            const Int32 EXPECTED_COUNT = 10;

            //Act
            CollectionHelpers.AddRangeIfNotExists(listOriginal, (alreadyPresent, toAdd) => alreadyPresent == toAdd, listToAdd);

            //Assert
            Assert.AreEqual(EXPECTED_COUNT, listOriginal.Count);
        }