Beispiel #1
0
        public void Residential_Scavenge()
        {
            for (int i = 0; i < 1000; i++)
            {
                items = new List <Item>();
                for (int j = 1; j < 21; j++)
                {
                    Item tmp = new Item(StringMaker.makeItemStr(j));
                    items.Add(tmp);
                }
                res = new Residential(1, rnd.Next(1, 10), rnd.Next(1, 10));
                var ids   = new List <int>();
                var found = res.Scavenge(items);
                Assert.IsTrue(res.GetScavenged(), "Should be scavenged");
                Assert.IsTrue(res.GetMaxItems() >= found.Count, "Items found should not exceed max");
                Assert.IsTrue(found.Count > 0, "Should be at least one item");
                foreach (Item item in found)
                {
                    Assert.IsFalse(ids.Contains(item.GetID()), "ID should not be in the list already");

                    ids.Add(item.GetID());
                    Assert.IsTrue(res.GetMaxAmount() >= item.GetAmount(), "Items found should not have more instances max");
                }

                found = res.Scavenge(items);
                Assert.IsTrue(found.Count == 0, "Should be no items in list");
            }
        }