GetCorners() public method

public GetCorners ( ) : IList
return IList
Esempio n. 1
0
        public void CornerAddCorner(float x, float y)
        {
            //arrange
            Room room = new Room("Leslokaal", 3, 4,1);

            //act
            room.AddCorner(new Corner(x, y));

            //assert
            List<Corner> corners = (List<Corner>)room.GetCorners();
            Assert.AreEqual(1, corners.Count);
            Assert.IsNotNull(corners[0]);
            Assert.IsInstanceOf(typeof(Corner), corners[0]);
        }
Esempio n. 2
0
        public void CornerAddCorners()
        {
            //arrange
            Room room = new Room("Leslokaal", 3, 4,4);

            //act
            room.AddCorners(new Corner(0, 0), new Corner(10, 0), new Corner(10, 10), new Corner(0, 10));

            //assert
            List<Corner> corners = (List<Corner>)room.GetCorners();
            Assert.AreEqual(4, corners.Count);
            Assert.IsNotNull(corners[0]);
            Assert.IsNotNull(corners[1]);
            Assert.IsNotNull(corners[2]);
            Assert.IsNotNull(corners[3]);
            Assert.IsInstanceOf(typeof(Corner), corners[0]);
            Assert.IsInstanceOf(typeof(Corner), corners[1]);
            Assert.IsInstanceOf(typeof(Corner), corners[2]);
            Assert.IsInstanceOf(typeof(Corner), corners[3]);
        }
Esempio n. 3
0
        public void NullAddCorner()
        {
            //arrange
            Room room = new Room("Leslokaal", 3, 4,2);

            //act
            room.AddCorner(null);

            //assert
            List<Corner> corners = (List<Corner>)room.GetCorners();
            Assert.AreEqual(0, corners.Count);
        }
Esempio n. 4
0
        /**
         * This method deletes a room from the blueprint.
         * All corners that aren't included in other rooms will be deleted and with them the walls that connect to them.
         */
        public void DeleteRoom(Room delRoom)
        {
            if(!this.Rooms.Contains(delRoom)) return;

            foreach(Corner corner in delRoom.GetCorners()) {
                bool contains = false;
                foreach(Room room in this.Rooms) {
                    if(room.Equals(delRoom)) continue;
                    contains |= room.GetCorners().Contains(corner);
                }
                if(!contains) {
                    Wall[] copy = ((List<Wall>)corner.GetWalls()).ToArray();
                    this.DeleteWall(copy);
                    corner.GetWalls().Clear();
                }
            }
            this.Rooms.Remove(delRoom);
        }