Пример #1
0
 public void CrashRb_ContainsAll_ArgumentNull()
 {
     var rb = new RankedBag <int> {
         5
     };
     var zz = rb.ContainsAll(null);
 }
Пример #2
0
        public void UnitRb_ContainsAll()
        {
            var rb1 = new RankedBag <int> {
                Capacity = 4
            };

            foreach (var ii in new int[] { 3, 5, 5, 5, 7, 7, 9 })
            {
                rb1.Add(ii);
            }

            var rb2 = new RankedBag <int> {
                Capacity = 4
            };

            foreach (var ii in rb1)
            {
                rb2.Add(ii);
            }

            Assert.IsTrue(rb1.ContainsAll(new int[] { }));
            Assert.IsTrue(rb1.ContainsAll(new int[] { 5, 5 }));
            Assert.IsTrue(rb1.ContainsAll(new int[] { 5, 5, 5 }));
            Assert.IsTrue(rb1.ContainsAll(new int[] { 5, 7 }));
            Assert.IsFalse(rb1.ContainsAll(new int[] { 5, 5, 5, 5 }));
            Assert.IsFalse(rb1.ContainsAll(new int[] { 1, 2, 3, 4, 5, 6, 7, 8 }));

            Assert.IsTrue(rb1.ContainsAll(rb2));
        }