コード例 #1
0
        public void WhenListsAreSameThenContainsShouldReturnTrue()
        {
            List <int> sourceList = new List <int>()
            {
                1, 2, 3, 4, 5, 6, 7, 8, 9, 10
            };

            Assert.IsTrue(IEnumerableUtil.Contains(sourceList, sourceList));
        }
コード例 #2
0
        public void WhenOtherListIsEmptyAndOtherDontThenContainsShouldReturnFalse()
        {
            List <int> sourceList = new List <int>()
            {
                2, 3, 4, 5, 6, 7, 8, 9, 1, 1
            };
            List <int> otherList = new List <int>()
            {
            };

            Assert.IsFalse(IEnumerableUtil.Contains(sourceList, otherList));
        }
コード例 #3
0
        public void WhenBothListsContainsDuplicatesThenContainsShouldReturnTrue()
        {
            List <int> sourceList = new List <int>()
            {
                1, 2, 3, 4, 5, 6, 7, 8, 9, 1
            };
            List <int> otherList = new List <int>()
            {
                2, 3, 4, 5, 6, 7, 8, 9, 1, 1
            };

            Assert.IsTrue(IEnumerableUtil.Contains(sourceList, otherList));
        }
コード例 #4
0
        public void WhenListsContainsDifferentElementsThenContainsShouldReturnFalse()
        {
            List <int> sourceList = new List <int>()
            {
                1, 2, 3, 4, 5, 6, 7, 8, 9, 10
            };
            List <int> otherList = new List <int>()
            {
                0, 0, 0, 0, 0, 0, 0, 0, 0, 0
            };

            Assert.IsFalse(IEnumerableUtil.Contains(sourceList, otherList));
        }
コード例 #5
0
        public void WhenListsContainsSameElementsButInDifferentOrderThenContainsShouldReturnTrue()
        {
            List <int> sourceList = new List <int>()
            {
                1, 2, 3, 4, 5, 6, 7, 8, 9, 10
            };
            List <int> otherList = new List <int>()
            {
                10, 9, 8, 7, 6, 5, 4, 3, 2, 1
            };

            Assert.IsTrue(IEnumerableUtil.Contains(sourceList, otherList));
        }
コード例 #6
0
 public void WhenOtherListIsNullThenContainsShouldThrowArgumentNullException()
 {
     Assert.ThrowsException <ArgumentNullException>(() => IEnumerableUtil.Contains(new List <int>()
     {
     }, null));
 }