-
Notifications
You must be signed in to change notification settings - Fork 0
/
board_test.py
57 lines (45 loc) · 2.14 KB
/
board_test.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#! /usr/local/bin/python
import unittest
from board import Board
from player import Player
class BoardTestCase(unittest.TestCase):
def setUp(self):
"""Sets up test senario"""
self.board = Board()
self.Player1 = Player("Player1")
self.Player2 = Player("Player2")
self.Player3 = Player("Player3")
self.board.set_player_location(self.Player1,'Study')
self.board.set_player_location(self.Player2,'Library-Conservatory')
self.board.set_player_location(self.Player3,'Hall')
def test_get_player_location(self):
"""Test if Board class can return the player's position"""
self.board.get_player_location(self.Player1)
def test_get_player_list(self):
"""Test if Board class can return locations of all players"""
self.board.get_player_list
def test_set_player_location(self):
""" Test if Board class can set new location for player"""
self.board.set_player_location(self.Player2,'Hall')
self.board.get_player_location(self.Player2)
def test_set_weapon_location(self):
"""Test if Board class can set weapon location"""
self.board.set_weapon_location("Rope","Hall")
def test_get_weapon_location(self):
"""Test if Board class can return location of a weapon"""
self.board.set_weapon_location("Lead Pipe","Study")
self.assertEqual(self.board.get_weapon_location("Lead Pipe"),"Study")
def test_get_rooms(self):
"""Test if Board class can return the list of rooms"""
self.board.get_rooms
def test_display_player_location(self):
"""Test if Board class can print the location of a player"""
self.Player1.character = "Miss Scarlet"
self.board.display_player_location(self.Player1)
def test_display_weapon_location(self):
"""Test if Board class can print the location of a weapon"""
self.board.display_weapon_location("Pistol") # No location for weapon
self.board.set_weapon_location("Pistol","Study")
self.board.display_weapon_location("Pistol")
if __name__ == '__main__':
unittest.main()