public GameController(ISlotMachine game, ITransactionService transactionService, UserManager <User> userManager, IUserBalanceService userBalanceService) { this.game = game; this.transactionService = transactionService; this.userManager = userManager; this.userBalanceService = userBalanceService; }
public void CheckWin_NotEnoughCoinsInMachine_ThrowException() { //Arrange _machine = new SlotMachine(99); //Act //Assert Assert.Throws <ArgumentException>(() => _machine.Play(1)); }
public CreditCalculator(ISlotMachine slotMachine, int spinCost, int winMultiplier) { if (slotMachine == null) throw new ArgumentNullException("slotMachine"); if (spinCost < 1) throw new ArgumentException("spinCost cannot be less than 1"); if (winMultiplier < 1) throw new ArgumentException("winMultiplier cannot be less than 1"); SlotMachine = slotMachine; SpinCost = spinCost; WinMultiplier = winMultiplier; }
public bool NewGame(decimal deposit) { if (deposit <= 0) { return(false); } m_Player = new Player { Balance = deposit }; m_SlotMachine = new SlotMachine(m_Player, new SymbolGenerator(), new CoefficientCalculator()); return(true); }
public void Play_Bet1GrapeMiddleRowWon_UserGetReward() { //Arrange _machine = new SlotMachine(40); string[,] slots = new string[3, 3] { { "🍒", "🍏", "💰" }, { "🍇", "🍇", "🍇" }, { "⚜️", "🍒", "🔔" } }; _machine.Slots = slots; //Act uint reward = _machine.Play(9); //Assert Assert.Equal(12, (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); }
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 Setup() { _apple = new Apple(_symbolSettingsOptions.Value.Apple); _pineapple = new Pineapple(_symbolSettingsOptions.Value.Pineapple); _banana = new Banana(_symbolSettingsOptions.Value.Banana); _wildCard = new Wildcard(_symbolSettingsOptions.Value.WildCard); _randomSymbolGenerator = Substitute.For <IRandomSymbolGenerator>(); var slotMachineOptions = Substitute.For <IOptions <SlotMachineSettings> >(); slotMachineOptions.Value.Returns(new SlotMachineSettings() { ReelSymbolsCount = 4, ReelsCount = 3, }); var symbolsProvider = Substitute.For <ISymbolsProvider>(); _slotMachine = new SlotMachine(_randomSymbolGenerator, slotMachineOptions, symbolsProvider); }
public PlayerTurn(IReader reader, IWriter writer, ISlotMachine slotMachine) { _writer = writer; _reader = reader; _slotMachine = slotMachine; }
public WinChecker(ISlotMachine slotMachine) { _slotMachine = slotMachine; }
public Controller(ISlotMachine slotMachine) { m_SlotMachine = slotMachine; }
public ConsoleSlotMachine(ISlotMachine slotMachine) { _slotMachine = slotMachine; }
public SlotMachineUnitTests() { _slotmachine = new BusinessLayer.SlotMachine(); _homecontroller = new HomeController(_slotmachine); }
public SlotGame(IPlayer player, IUserHandler userHandler, ISlotMachine slotMachine) { this.currentPlayer = player; this.userHandler = userHandler; this.slotMachine = slotMachine; }
public HomeController(ISlotMachine slotmachine) { _slotmachine = slotmachine; }