public void GetRoomForExitReturnsNullForNonExistentRoom_UnLockedDoor() { var game = new Game(); var room = new Room("testRoom", "this is a test room.", game); var room2 = new Room("testRoom2", "this is a test room.", game); var roomExits = new RoomExits(); roomExits.AddExit(Direction.North, room); roomExits.AddExit(Direction.South, room2); Assert.AreEqual(null, roomExits.GetRoomForExit(Direction.East)); Assert.AreEqual(null, roomExits.GetRoomForExit(Direction.West)); }
public void GetRoomForExitReturnsValidRoom_UnLockedDoor() { var game = new Game(); var room = new Room("testRoom", "this is a test room.", game); var room2 = new Room("testRoom2", "this is a test room.", game); var roomExits = new RoomExits(); roomExits.AddExit(Direction.North, room); roomExits.AddExit(Direction.South, room2); Assert.AreEqual(room, roomExits.GetRoomForExit(Direction.North)); Assert.AreEqual(room2, roomExits.GetRoomForExit(Direction.South)); }
public void AddExitThrowsInvalidOperationExceptionIfSameDirectionUsedMoreThanOnce_UnLockedDoor() { var game = new Game(); var room = new Room("testRoom", "this is a test room.", game); var room2 = new Room("testRoom2", "this is a test room.", game); var roomExits = new RoomExits(); roomExits.AddExit(Direction.North, room); roomExits.AddExit(Direction.North, room2); roomExits.AddExit(Direction.South, room); roomExits.AddExit(Direction.South, room2); }
public void AddExitThrowsArgumentNullExceptionIfRoomIsNull() { RoomExits roomExits = new RoomExits(); DoorWay doorway = new DoorWay { Direction = Direction.North }; roomExits.AddExit(doorway, null); }
public void GetRoomForExitReturnsValidRoom() { var game = new Game(); var room = new Room("testRoom", "this is a test room.", game); var room2 = new Room("testRoom2", "this is a test room.", game); var roomExits = new RoomExits(); DoorWay doorway = new DoorWay { Direction = Direction.North }; DoorWay doorway2 = new DoorWay { Direction = Direction.South }; roomExits.AddExit(doorway, room); roomExits.AddExit(doorway2, room2); Assert.AreEqual(room, roomExits.GetRoomForExit(Direction.North)); Assert.AreEqual(room2, roomExits.GetRoomForExit(Direction.South)); }
public void AddExitThrowsInvalidOperationExceptionIfSameDirectionUsedMoreThanOnce() { var game = new Game(); var room = new Room("testRoom", "this is a test room.", game); var room2 = new Room("testRoom2", "this is a test room.", game); var roomExits = new RoomExits(); DoorWay doorway = new DoorWay { Direction = Direction.North }; DoorWay doorway2 = new DoorWay { Direction = Direction.South }; roomExits.AddExit(doorway, room); roomExits.AddExit(doorway, room2); roomExits.AddExit(doorway2, room); roomExits.AddExit(doorway2, room2); }
public void AddExitForNorthAddsTheExit_UnLockedDoor() { var game = new Game(); var room = new Room("testRoom", "this is a test room.", game); var roomExits = new RoomExits(); roomExits.AddExit(Direction.North, room); var savedRoom = roomExits.GetRoomForExit(Direction.North); Assert.AreEqual(room, savedRoom); Assert.AreSame("testRoom", savedRoom.Name); Assert.AreSame("this is a test room.", savedRoom.Description); }
public void AddExitForNorthAddsTheExit() { var game = new Game(); var room = new Room("testRoom", "this is a test room.", game); var roomExits = new RoomExits(); DoorWay doorway = new DoorWay { Direction = Direction.North }; roomExits.AddExit(doorway, room); var savedRoom = roomExits.GetRoomForExit(Direction.North); Assert.AreEqual(room, savedRoom); Assert.AreSame("testRoom", savedRoom.Name); Assert.AreSame("this is a test room.", savedRoom.Description); }