public void RemoveNull()
        {
            UnitGroup unitGroup = new UnitGroup();

            unitGroup.Remove(null);
            Assert.Fail();
        }
        public void RemoveUnitNotInUnitGroup()
        {
            Unit      unit      = new Unit("Test", 42, "Test Unit 42");
            UnitGroup unitGroup = new UnitGroup();

            unitGroup.Remove(unit);
            Assert.Fail();
        }
        public void RemoveUnit()
        {
            Unit      unit      = new Unit("Test", 42, "Test Unit 42");
            UnitGroup unitGroup = new UnitGroup();

            unitGroup.Add(unit);
            unitGroup.Remove(unit);
            Assert.AreEqual(0, unitGroup.Units.Count);
        }
示例#4
0
 public void setGroup(UnitGroup newGroup)
 {
     if (group != null)
     {
         group.Remove(this);
         group = null;
     }
     if (newGroup != null)
     {
         newGroup.Add(this);
         group = newGroup;
     }
 }