public void PurchaseClicked() { MyMessenger.Send(BUY_TRAINER_MESSAGE); mTrainerManager.InitiateTrainerPurchase(mResources); BackendManager.Backend.MakeTrainerPurchase(); }
public void VerifyNextTrainerPurchaseIncreasesTrainers(int i_numTrainers, int i_expectedCostForNextTrainer) { mTrainerData.TotalTrainers = i_numTrainers; mTrainerData.AvailableTrainers = i_numTrainers; int expectedTrainersAfterPurchase = mTrainerData.TotalTrainers + 1; mTrainerData.InitiateTrainerPurchase(new FullInventory()); Assert.AreEqual(mTrainerData.TotalTrainers, expectedTrainersAfterPurchase); }
public void VerifyNextTrainerPurchaseSpendsResources(int i_numTrainers, int i_expectedCostForNextTrainer) { Dictionary <string, int> trainers = new Dictionary <string, int>(); trainers.Add(TrainerManager.NORMAL_TRAINERS, i_numTrainers); mTrainerData = new TrainerManager(new ViewModel(), CreateTrainerSaveData_WithCounts(trainers), new Dictionary <string, UnitProgress>()); int costForNextTrainer = mTrainerData.GetNextTrainerCost(); NormalInventory realInventory = new NormalInventory(); realInventory.SetResource(VirtualCurrencies.GOLD, costForNextTrainer); mTrainerData.InitiateTrainerPurchase(realInventory); Assert.AreEqual(realInventory.GetResourceCount(VirtualCurrencies.GOLD), 0); }