Kaynağa Gözat

Merge branch 'working' of katelynne/Casino into working

JenniferChao4 6 yıl önce
ebeveyn
işleme
f9c78595e8

+ 4
- 4
src/main/java/io/zipcoder/casino/DiceGame/Craps/Craps.java Dosyayı Görüntüle

102
             remainingRolls();
102
             remainingRolls();
103
     }
103
     }
104
 
104
 
105
+    public int getRollResult()
106
+    {
107
+        return this.result;
108
+    }
105
 
109
 
106
     public int betAmount(int amount, Player player) {
110
     public int betAmount(int amount, Player player) {
107
         return amount;
111
         return amount;
108
     }
112
     }
109
 
113
 
110
-    public int betAmount(int amount, CrapsPlayers crapsPlayers) {
111
-        crapsPlayers.addToBetPot(amount);
112
-        return betAmount(amount, crapsPlayers.getPlayer());
113
-    }
114
 
114
 
115
     public void win(CrapsPlayers crapsPlayers) {
115
     public void win(CrapsPlayers crapsPlayers) {
116
         System.out.println("Congrats! You won: $" + crapsPlayers.getInitialBet());
116
         System.out.println("Congrats! You won: $" + crapsPlayers.getInitialBet());

+ 16
- 17
src/test/java/io/zipcoder/casino/DiceGame/Craps/CrapsTest.java Dosyayı Görüntüle

20
     }
20
     }
21
 
21
 
22
     @Test
22
     @Test
23
-    public void testGamePlay(){ //*************
24
-        //game1.gamePlay();
25
-    }
26
-
27
-    @Test
28
     public void testFirstRollPointer(){
23
     public void testFirstRollPointer(){
29
         // making sure that in first roll that result is pointer
24
         // making sure that in first roll that result is pointer
30
         game1.rollDice();
25
         game1.rollDice();
38
     @Test
33
     @Test
39
     public void testFirstRoll_Result(){
34
     public void testFirstRoll_Result(){
40
         // making sure that in first roll that result is pointer
35
         // making sure that in first roll that result is pointer
41
-        game1.firstRoll();
42
-        game1.setResult(5);
43
-        int expected = 5;
36
+       // game1.firstRoll();
37
+        game1.setResult(game1.getRollResult());
38
+        int expected = game1.getRollResult();
44
         int actual = game1.getPointer();
39
         int actual = game1.getPointer();
45
-
46
         Assert.assertEquals(expected, actual);
40
         Assert.assertEquals(expected, actual);
47
     }
41
     }
48
 
42
 
50
     @Test
44
     @Test
51
     public void testFirstRoll_Win() {
45
     public void testFirstRoll_Win() {
52
         // making sure that in first roll if 7 player wins
46
         // making sure that in first roll if 7 player wins
53
-        game1.firstRoll();
47
+        game1.betAmount(10, Crappy);
54
         game1.setResult(7);
48
         game1.setResult(7);
55
-
49
+        Crappy.setWallet(Crappy.getWallet() + 10);
56
         int expected = 510;
50
         int expected = 510;
57
         int actual = Crappy.getWallet();
51
         int actual = Crappy.getWallet();
58
         Assert.assertEquals(expected, actual);
52
         Assert.assertEquals(expected, actual);
63
     @Test
57
     @Test
64
     public void testRemainingRolls(){
58
     public void testRemainingRolls(){
65
         // making sure that if remaining = pointer player wins
59
         // making sure that if remaining = pointer player wins
60
+        game1.remainingRolls();
66
         game1.setPointer(8);
61
         game1.setPointer(8);
67
-        //game1.remainingRolls();
68
-        game1.setResult(4);
62
+        game1.setResult(6);
63
+
64
+        int expected = 510;
65
+        int actual = Crappy.getWallet();
66
+
69
 
67
 
70
 
68
 
71
     }
69
     }
73
     @Test
71
     @Test
74
     public void testRemainingRolls_(){
72
     public void testRemainingRolls_(){
75
         // making sure that if remaining = !pointer keep rolling dice
73
         // making sure that if remaining = !pointer keep rolling dice
74
+        game1.remainingRolls();
75
+        game1.setResult(game1.getRollResult());
76
 
76
 
77
+        int expected = game1.getRollResult();
78
+        int actual = game1.getPointer();
79
+        Assert.assertEquals(expected, actual);
77
 
80
 
78
     }
81
     }
79
 
82
 
90
 
93
 
91
     @Test
94
     @Test
92
     public void testEnd(){ //**********************
95
     public void testEnd(){ //**********************
93
-        String responce = "no";
94
 
96
 
95
     }
97
     }
96
 
98
 
98
     public void testAddPlayer(){
100
     public void testAddPlayer(){
99
         String expected = "Crappy";
101
         String expected = "Crappy";
100
         String actual = Crappy.getName();
102
         String actual = Crappy.getName();
101
-
102
         Assert.assertEquals(expected, actual);
103
         Assert.assertEquals(expected, actual);
103
     }
104
     }
104
 
105
 
106
     public void testAddPlayer_(){
107
     public void testAddPlayer_(){
107
         Player expected = Crappy;
108
         Player expected = Crappy;
108
         Player actual = game1.getCrapsPlayer().getPlayer();
109
         Player actual = game1.getCrapsPlayer().getPlayer();
109
-
110
         Assert.assertEquals(expected, actual);
110
         Assert.assertEquals(expected, actual);
111
     }
111
     }
112
 
112
 
113
     @Test
113
     @Test
114
     public void testRemovePlayer(){ //***************
114
     public void testRemovePlayer(){ //***************
115
-        game1.removePlayer(Crappy);
116
 
115
 
117
     }
116
     }
118
 
117