示例#1
0
        /// <summary>
        /// Builds a new house in the yard
        /// </summary>
        /// <returns>The newly-built house</returns>
        public House BuildHouse()
        {
            if (HouseIsInYard())
            {
                throw new BuildingCodeException("You can't build a second house in this yard.");
            }

            House house = new House();
            Transfer(house).To(this);
            return house;
        }
示例#2
0
 /// <summary>
 /// Allows a wandering dog to wander into a particular house
 /// </summary>
 /// <param name="house">The house into which the dog will wander</param>
 public void WanderInto(House house)
 {
     CheckMovementRules();
     house.Transfer(this).To(house);
 }