public IEnumerator WHEN_FillAllGameDataFunctionCalled_THEN_GameDataIsFilled() { // Make all games labelled as played Globals.isBalloonsButtonOn = false; Globals.isCTFButtonOn = false; Globals.isImageHitButtonOn = false; Globals.isSquaresButtonOn = false; Globals.isCatchTheBallButtonOn = false; Globals.isJudgeTheBallButtonOn = false; Globals.isSaveOneBallButtonOn = false; BatterySessionManagement batterySessionManagement = new BatterySessionManagement(); batterySessionManagement.FillAllGameData(); yield return(null); // Game data should be filled with actual gameplay data from each game Assert.AreEqual(Balloons.GetGameplayData(), batterySessionManagement.balloonsData); Assert.AreEqual(CatchTheThief.GetGameplayData(), batterySessionManagement.ctfData); Assert.AreEqual(Squares.GetGameplayData(), batterySessionManagement.squaresData); Assert.AreEqual(ImageHit.GetGameplayData(), batterySessionManagement.imageHitData); Assert.AreEqual(CatchTheBall.GetGameplayData(), batterySessionManagement.catchTheBallData); Assert.AreEqual(JudgeTheBall.GetGameplayData(), batterySessionManagement.judgeTheBallData); Assert.AreEqual(SaveOneBall.GetGameplayData(), batterySessionManagement.saveOneBallData); }
public IEnumerator WHEN_GetGameplayDataFunctionCalled_THEN_GamePlayDataRetured() { BalloonsStorage balloonsData1 = Balloons.GetGameplayData(); List <BalloonsRound> expectedRoundsData1 = new List <BalloonsRound>(); Assert.AreEqual(expectedRoundsData1, balloonsData1.Rounds); balloonScript.ClickOnBalloon(); yield return(new WaitForSeconds(0.01f)); // After the click on balloon that is located on center point: BalloonsStorage balloonsData2 = Balloons.GetGameplayData(); List <BalloonsRound> expectedRoundsData2 = new List <BalloonsRound>(); Assert.AreEqual(expectedRoundsData2, balloonsData2.Rounds); // Take 0.01s to click on the balloon that is in random position balloonScript.ClickOnBalloon(); yield return(new WaitForSeconds(0.01f)); // After the click on balloon that is located on random position: BalloonsStorage balloonsData3 = Balloons.GetGameplayData(); double expectedBalloonSize = 200; List <TimeAndPosition> expectedClicks = new List <TimeAndPosition>(); Assert.AreEqual(1, balloonsData3.Rounds.Count); Assert.IsTrue(Math.Abs(expectedBalloonSize - balloonsData3.Rounds[0].BalloonSize) <= tolerance); Assert.AreEqual(expectedClicks, balloonsData3.Rounds[0].Clicks); }
/// <summary> /// FillAllGameData is to update game data objects with corresponding raw gameplay data. /// It will only get gameplay data for the games that have been played. /// </summary> public void FillAllGameData() { // Get gameplay data for Balloons // If the game has been played, get the gameplay data; else, skip this game if (!notYetPlayBalloons) { balloonsData = Balloons.GetGameplayData(); } // Get gameplay data for Squares // If the game has been played, get the gameplay data; else, skip this game if (!notYetPlaySquares) { squaresData = Squares.GetGameplayData(); } // Get gameplay data for Catch The Thief // If the game has been played, get the gameplay data; else, skip this game if (!notYetPlayCTF) { ctfData = CatchTheThief.GetGameplayData(); } // Get gameplay data for ImageHit // If the game has been played, get the gameplay data; else, skip this game if (!notYetPlayImageHit) { imageHitData = ImageHit.GetGameplayData(); } // Get gameplay data for Catch The Ball // If the game has been played, get the gameplay data; else, skip this game if (!notYetCatchTheBall) { catchTheBallData = CatchTheBall.GetGameplayData(); } // Get gameplay data for Save One Ball // If the game has been played, get the gameplay data; else, skip this game if (!notYetSaveOneBall) { saveOneBallData = SaveOneBall.GetGameplayData(); } // Get gameplay data for Judge The Ball // If the game has been played, get the gameplay data; else, skip this game if (!notYetJudgeTheBall) { judgeTheBallData = JudgeTheBall.GetGameplayData(); } }