示例#1
0
        public async Task GetAllChallenge()
        {
            try
            {
                // Arrange
                ChallengeController controller = new ChallengeController();
                controller.Request = new HttpRequestMessage();
                controller.Request.Properties.Add(HttpPropertyKeys.HttpConfigurationKey, new HttpConfiguration());
                // Act
                ChallengeProvider _ChallengeProvider = new ChallengeProvider();
                var testProducts = await _ChallengeProvider.GetAll() as List <Challenge>;

                int testproduct = testProducts.Count;
                // Act
                var response = await controller.GetChallenges() as HttpResponseMessage;

                ObjectContent    objContent   = response.Content as ObjectContent;
                List <Challenge> picklistItem = objContent.Value as List <Challenge>;
                int icount = picklistItem.Count;

                var response1 = await controller.GetChallengesByCategoryClub(1, 5) as HttpResponseMessage;

                ObjectContent    objContent1   = response1.Content as ObjectContent;
                List <Challenge> picklistItem1 = objContent1.Value as List <Challenge>;


                // Assert
                Assert.IsNotNull(response);
                Assert.AreEqual(testproduct, icount);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
示例#2
0
 void SaveCurrentGameData(float[] damageTaken, bool isQuit)
 {
     data.killSum += killSum;
     if (killSum > data.highScoreKill)
     {
         data.highScoreKill = killSum;
     }
     if ((int)currentGameTime > (int)data.highScoreTime)
     {
         data.highScoreTime = currentGameTime;
     }
     data.sumTime += currentGameTime;
     data.gameNumber++;
     for (int i = 0; i < data.killSpecificEnemies.Length; i++)
     {
         data.killSpecificEnemies[i] += currentEnemiesKilled[i];
     }
     for (int i = 0; i < data.damageFromEnemies.Length; i++)
     {
         data.damageFromEnemies[i] += damageTaken[i];
     }
     adCounter++;
     if (adCounter >= adLimit)
     {
         TriggerAd(isQuit, false);
         adCounter = 0;
         adLimit   = Random.Range(2, 4);
     }
     data.challenges = challengeCont.GetChallenges();
     data.comboSum  += comboSum;
     waitingExp      = starReward + Mathf.Min(comboSum, 150);
     StartCoroutine(UICont.SetExpBar(Mathf.Min(data.exp + waitingExp, maxExp), data.level, false));
     if (shopCont.GetLevelWithExp(data.exp + waitingExp) > data.level)
     {
         for (int i = data.level + 1; i < shopCont.GetLevelWithExp(data.exp + waitingExp) + 1; i++)
         {
             data.ownedAbilities[i] = 1;
             shopCont.UnlockAbility(i);
         }
         data.level = shopCont.GetLevelWithExp(data.exp + waitingExp);
     }
     shopCont.GiveStars(true, starReward, -1);
     StartCoroutine(shopCont.StartRewardStars());
 }