Esempio n. 1
0
        public void UnitRb_ElementsFrom()
        {
            var rb0 = new RankedBag <int>();
            var rb1 = new RankedBag <int> {
                Capacity = 4
            };
            var rb2 = new RankedBag <int> (new int[] { 5, 5, 5, 5, 5 });

            foreach (var i1 in new int[] { 3, 4, 5, 5, 6, 6, 7, 7, 8 })
            {
                rb1.Add(i1);
            }

            var d0 = new System.Collections.Generic.List <int> (rb0.ElementsFrom(0));

            Assert.AreEqual(0, d0.Count);

            var d1 = new System.Collections.Generic.List <int> (rb1.ElementsFrom(6));

            Assert.AreEqual(5, d1.Count);

            var d2 = new System.Collections.Generic.List <int> (rb1.ElementsFrom(1));

            Assert.AreEqual(9, d2.Count);

            var d3 = new System.Collections.Generic.List <int> (rb2.ElementsFrom(5));

            Assert.AreEqual(5, d3.Count);

            var d5 = new System.Collections.Generic.List <int> (rb2.ElementsFrom(9));

            Assert.AreEqual(0, d5.Count);
        }