예제 #1
0
        public void DoorAddWall()
        {
            //Arrange
            Corner left = new Corner(new PointF(0, 0));
            Corner right = new Corner(new PointF(10, 0));
            Door door = new Door(left, right);

            //Act
            left.AddWall(door);
            right.AddWall(door);

            //Assert
            IList lWalls = left.GetWalls();
            Assert.AreEqual(1, lWalls.Count);
            Assert.IsInstanceOf<Door>(lWalls[0]);
            Assert.AreEqual(door, lWalls[0]);
        }
예제 #2
0
        public void MixedAddWalls()
        {
            //Arrange
            Corner corn1 = new Corner(new PointF(0, 0));
            Corner corn2 = new Corner(new PointF(10, 0));
            Corner corn3 = new Corner(new PointF(10, 10));
            Wall wall = new Wall(corn1, corn2);
            Door door = new Door(corn2, corn3);

            //Act
            corn2.AddWalls(wall, door);

            //Assert
            IList lWalls = corn2.GetWalls();
            Assert.AreEqual(2, lWalls.Count);
            Assert.AreEqual(wall, lWalls[0]);
            Assert.AreEqual(door, lWalls[1]);
        }
예제 #3
0
파일: Room.cs 프로젝트: Railec/SE1cKBS2
        /**
         * This method is a recurisve method to find the outline of a room through connecting corners.
         * The output can be found in the points param.
         */
        private void GetOutline(List<PointF> points, Corner corner, List<Wall> excludes = null)
        {
            if(excludes == null) excludes = new List<Wall>();

            points.Add(corner.GetPoint());
            foreach(Wall wall in corner.GetWalls()) {
                Corner nextCorner = (wall.Left == corner ? wall.Right : wall.Left);

                if(!excludes.Contains(wall) && this._corners.Contains(nextCorner)) {
                    excludes.Add(wall);
                    GetOutline(points, nextCorner, excludes);
                }
            }
        }
예제 #4
0
 /**
  * This method deletes a corner from the blueprint.
  * All walls that connect to this corner will also be deleted.
  */
 public void DeleteCorner(Corner delCorner)
 {
     Wall[] copy = ((List<Wall>)delCorner.GetWalls()).ToArray();
     this.DeleteWall(copy);
     foreach(Room room in this.Rooms) {
         room.GetCorners().Remove(delCorner);
     }
 }
예제 #5
0
        public void NullAddWalls()
        {
            //Arrange
            Corner corn1 = new Corner(new PointF(0, 0));
            Corner corn2 = new Corner(new PointF(10, 0));
            Corner corn3 = new Corner(new PointF(10, 10));
            Wall wall1 = new Wall(corn1, corn2);
            Wall wall2 = null;

            //Act
            corn2.AddWalls(wall2, wall1);

            //Assert
            IList lWalls = corn2.GetWalls();
            Assert.AreEqual(1, lWalls.Count);
            Assert.AreEqual(wall1, lWalls[0]);
        }
예제 #6
0
        public void NullAddWall()
        {
            //Arrange
            Corner left = new Corner(new PointF(0, 0));
            Corner right = new Corner(new PointF(10, 0));
            Wall wall = null;

            //Act
            left.AddWall(wall);
            right.AddWall(wall);

            //Assert
            IList lWalls = left.GetWalls();
            Assert.AreEqual(0, lWalls.Count);
        }