Example #1
0
        public void VerifyNextTrainerCosts(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();

            Assert.AreEqual(i_expectedCostForNextTrainer, costForNextTrainer);
        }
Example #2
0
        public void CanAffordNewTrainer_RealInventory(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);

            bool canAfford = mTrainerData.CanAffordTrainerPurchase(realInventory);

            Assert.IsTrue(canAfford);
        }
Example #3
0
        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);
        }