public void ContainsAllTestNullCheck()
        {
            // ReSharper disable once ReturnValueOfPureMethodIsNotUsed
            // ReSharper disable once AssignNullToNotNullAttribute
            Action test = () => IEnumerableTEx.ContainsAll(null, new Object(), new Object());

            test.ShouldThrow <ArgumentNullException>();
        }
        public void ContainsAllTest1NullCheck()
        {
            // ReSharper disable once AssignNullToNotNullAttribute
            // ReSharper disable once ReturnValueOfPureMethodIsNotUsed
            Action test = () => IEnumerableTEx.ContainsAll(null, new List <String>());

            Assert.Throws <ArgumentNullException>(test);
        }
Example #3
0
        public void ForEachTestNullCheck()
        {
            List <Object> list = null;
            // ReSharper disable once ReturnValueOfPureMethodIsNotUsed
            // ReSharper disable once AssignNullToNotNullAttribute
            Action test = () => IEnumerableTEx.ForEach(list, Console.WriteLine);

            test.ShouldThrow <ArgumentNullException>();
        }
Example #4
0
        public void ForEachTest1()
        {
            var list = RandomValueEx.GetRandomStrings(10);

            // ReSharper disable once ReturnValueOfPureMethodIsNotUsed
            Action test = () => IEnumerableTEx.ForEach(list, x => list.Remove(x));

            test.ShouldThrow <InvalidOperationException>();
        }
Example #5
0
        public void ForEachTestNullCheck1()
        {
            Action <Object> action = null;
            // ReSharper disable once ReturnValueOfPureMethodIsNotUsed
            // ReSharper disable once AssignNullToNotNullAttribute
            Action test = () => IEnumerableTEx.ForEach(new List <Object>(), action);

            test.ShouldThrow <ArgumentNullException>();
        }
Example #6
0
        public void ForEachTest2()
        {
            var list      = RandomValueEx.GetRandomStrings(10);
            var otherList = new List <String>();

            var actual = IEnumerableTEx.ForEach(list, otherList.Add);

            Assert.Same(list, actual);
            Assert.Equal(list.Count, otherList.Count);
            Assert.True(list.All(otherList.Contains));
        }
Example #7
0
        public void GetEqualItemsFromStartArgumentNullException()
        {
            Action test = () =>
            {
                // ReSharper disable once AssignNullToNotNullAttribute
                var result = IEnumerableTEx.GetEqualItemsFromStart(null, Enumerable.Empty <Int32>());
                result.Should()
                .BeNull("Should have thrown exception");
            };

            Assert.Throws <ArgumentNullException>(test);
        }