public void AutoBattleEngine_GetRoundsCount_Should_Pass()
        {
            // Arrange
            var myEngine = new AutoBattleEngine();
            var Expected = 0;   // 1 because it is not defined yet

            // Act
            var Actual = myEngine.GetRoundCount();

            // Reset

            // Assert
            Assert.AreEqual(Expected, Actual, TestContext.CurrentContext.Test.Name);
        }
Esempio n. 2
0
        // Button Logic for AutoBattle page.
        private async void AutoBattleButton_Command(object sender, EventArgs e)
        {
            // Hold the score property to give to the score navigation later
            Score myScoreObject = new Score();

            // Can create a new battle engine...
            var myEngine = new AutoBattleEngine();


            //await Task.Run(async () =>
            //{
            var result = myEngine.ExecuteAutoBattle();

            if (result == false)
            {
                await DisplayAlert("Error", "No Characters Avaialbe", "OK");

                return;
            }

            if (myEngine.GetRoundCount() < 1)
            {
                await DisplayAlert("Error", "No Rounds Fought", "OK");

                return;
            }

            var myResult = myEngine.GetResultsOutput();
            var myScore  = myEngine.GetScoreValue();

            var outputString = "Battle Over! Score " + myScore.ToString();

            myScoreObject = myEngine.GetScoreObject();
            // });

            await Navigation.PushAsync(new ScoreDetailPage(new ScoreDetailViewModel(myScoreObject)));
        }