public void CheckWin_NotEnoughCoinsInMachine_ThrowException() { //Arrange _machine = new SlotMachine(99); //Act //Assert Assert.Throws <ArgumentException>(() => _machine.Play(1)); }
public void Play_Bet1NotWon_UserGet0Reward() { //Arrange string[,] slots = new string[3, 3] { { "🍒", "🍏", "💰" }, { "🍏", "🍇", "🍇" }, { "⚜️", "🍒", "🔔" } }; var slotsRandomizer = new Mock <ISlotsRandomizer>(); slotsRandomizer.Setup(i => i.Prepare()).Returns(slots); _machine = new SlotMachine(SlotMachineConstants.MINIMUM_COINS, slotsRandomizer.Object); //Act uint reward = _machine.Play(9); //Assert Assert.Equal(0, (int)reward); slots = new string[3, 3] { { "🍒", "🍏", "💰" }, { "🍇", "🍏", "🍇" }, { "⚜️", "🍒", "🔔" } }; slotsRandomizer.Setup(i => i.Prepare()).Returns(slots); //Act reward = _machine.Play(9); //Assert Assert.Equal(0, (int)reward); slots = new string[3, 3] { { "🍒", "🍏", "💰" }, { "🍇", "🍇", "🍏" }, { "⚜️", "🍒", "🔔" } }; slotsRandomizer.Setup(i => i.Prepare()).Returns(slots); //Act reward = _machine.Play(9); //Assert Assert.Equal(0, (int)reward); }
public void Play_Bet1NotWon_UserGetReward() { //Arrange _machine = new SlotMachine(40); string[,] slots = new string[3, 3] { { "🍒", "🍏", "💰" }, { "🍏", "🍇", "🍇" }, { "⚜️", "🍒", "🔔" } }; _machine.Slots = slots; //Act uint reward = _machine.Play(9); //Assert Assert.Equal(0, (int)reward); slots = new string[3, 3] { { "🍒", "🍏", "💰" }, { "🍇", "🍏", "🍇" }, { "⚜️", "🍒", "🔔" } }; _machine.Slots = slots; //Act reward = _machine.Play(9); //Assert Assert.Equal(0, (int)reward); slots = new string[3, 3] { { "🍒", "🍏", "💰" }, { "🍇", "🍇", "🍏" }, { "⚜️", "🍒", "🔔" } }; _machine.Slots = slots; //Act reward = _machine.Play(9); //Assert Assert.Equal(0, (int)reward); }
public void Play_Bet10Coins1000Jackpot_UserGet800Jackpot() { //Arrange string[,] slots = new string[3, 3] { { "🍒", "🍏", "💰" }, { "💰", "💰", "💰" }, { "⚜️", "🍒", "🔔" } }; var slotsRandomizer = new Mock <ISlotsRandomizer>(); slotsRandomizer.Setup(i => i.Prepare()).Returns(slots); _machine = new SlotMachine(1000, slotsRandomizer.Object); //Act uint reward = _machine.Play(10); //Assert Assert.Equal(650, (int)reward); }