コード例 #1
0
ファイル: GuestTests.cs プロジェクト: rickyvelis/HotelProject
        public void Guests_Take_Quickest_Path_To_Destination()
        {
            Guest guest       = new Guest(1, 0);
            IRoom destination = _Hotel.iRoom.Single(r => r.Position.X == 8 && r.Position.Y == 5);

            List <Point> path = new List <Point>();

            foreach (IRoom r in guest.FindRoom(destination))
            {
                path.Add(r.Position);
            }

            List <Point> actualResult   = path;
            List <Point> expectedResult = new List <Point>()
            {
                new Point(1, 0), //Lobby
                new Point(0, 0), //Elevator
                new Point(1, 5), //Room
                new Point(2, 5), //Hall
                new Point(3, 5), //Room
                new Point(4, 5), //Hall
                new Point(5, 5), //Room
                new Point(6, 5), //Hall
                new Point(7, 5), //Hall
                new Point(8, 5)  //Hall
            };

            expectedResult.Reverse();

            for (int i = 0; i < path.Count; i++)
            {
                Assert.AreEqual(actualResult[i], expectedResult[i]);
            }
        }