Exemple #1
0
        public void AutoBattleEngine_AddCharactersToBattle_Count_is_6_Should_Pass()
        {
            // Arrange
            var myEngine = new BattleEngine();
            var Expected = true;

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

            // Assert that it's not null.
            Assert.AreEqual(Expected, Actual, TestContext.CurrentContext.Test.Name);
        }
Exemple #2
0
        public void BattleEngine_AddCharactersToBattle_With_No_Characters_Should_Pass()
        {
            MockForms.Init();

            // Can create a new battle engine...
            var myBattleEngine = new BattleEngine();
            var Return         = myBattleEngine.AddCharactersToBattle();

            var Actual   = myBattleEngine.CharacterList.Count;
            var Expected = 6;

            Assert.AreEqual(true, Return, " Pass Fail " + TestContext.CurrentContext.Test.Name);
            Assert.AreEqual(Expected, Actual, " Count " + TestContext.CurrentContext.Test.Name);
        }
Exemple #3
0
        public void BattleEngineInit()
        {
            // Picks 6 Characters
            if (myBattleEngine.AddCharactersToBattle() == false)
            {
                // No characters in db yet
                // TODO: EXIT with error of no characters
            }

            // Start with user battle
            myBattleEngine.StartBattle(false);

            Debug.WriteLine("Battle Start" + " Characters :" + myBattleEngine.CharacterList.Count);

            myBattleEngine.StartRound();
        }
        public void BattleEngine_AddCharacter_Should_Create_1_Characters()
        {
            // Set a new Battle Engine
            // Create new Characters, 1 is the default

            // Arrange
            var myEngine = new BattleEngine();
            var Expect   = 1;

            // Act
            myEngine.AddCharactersToBattle();
            var Actual = myEngine.CharacterList.Count;

            // Assert
            Assert.AreEqual(Expect, Actual, TestContext.CurrentContext.Test.Name);
        }
Exemple #5
0
        public void BattleEngine_AddCharactersToBattle_With_Empty_CharacterListView_Should_Fail()
        {
            MockForms.Init();

            // Can create a new battle engine...
            var myBattleEngine = new BattleEngine();

            // Clear the dataset...
            CharactersViewModel.Instance.Dataset.Clear();

            var Return = myBattleEngine.AddCharactersToBattle();

            // Reset
            MasterDataStore.ForceDataRestoreAll();

            Assert.AreEqual(false, Return, TestContext.CurrentContext.Test.Name);
        }
Exemple #6
0
        public void BattleEngine_AddCharactersToBattle_With_Empty_CharacterList_Should_Create_Characters()
        {
            MockForms.Init();

            // Can create a new battle engine...
            var myBattleEngine = new BattleEngine();

            // Force data for Characters and Items to be loaded and ready...
            MasterDataStore.ForceDataRestoreAll();

            var myItems = ItemsViewModel.Instance;

            var Return = myBattleEngine.AddCharactersToBattle();

            var Actual   = myBattleEngine.CharacterList.Count;
            var Expected = 6;

            Assert.AreEqual(true, Return, " Pass Fail " + TestContext.CurrentContext.Test.Name);
            Assert.AreEqual(Expected, Actual, TestContext.CurrentContext.Test.Name);
        }
        public void BattleEngine_AddCharacter_No_Characters_Should_Fail()
        {
            // Set a new Battle Engine
            // Create new Characters, 6 is the default

            // Arrange
            var myEngine = new BattleEngine();

            for (var i = 0; i < GameGlobals.MaxNumberPartyPlayers; i++)
            {
                myEngine.CharacterList.Add(new Character());
            }

            bool Expect = true; // Engine is ready to go...

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

            // Assert
            Assert.AreEqual(Expect, Actual, TestContext.CurrentContext.Test.Name);
        }
        public void BattleEngine_AddCharactersToBattle_With_6_Characters_Should_Skip()
        {
            MockForms.Init();

            // Can create a new battle engine...
            var myBattleEngine = new BattleEngine();

            myBattleEngine.CharacterList.Add(new Character());
            myBattleEngine.CharacterList.Add(new Character());
            myBattleEngine.CharacterList.Add(new Character());
            myBattleEngine.CharacterList.Add(new Character());
            myBattleEngine.CharacterList.Add(new Character());
            myBattleEngine.CharacterList.Add(new Character());

            var Return = myBattleEngine.AddCharactersToBattle();

            var Actual   = myBattleEngine.CharacterList.Count;
            var Expected = GameGlobals.MaxNumberPartyPlayers;

            Assert.AreEqual(true, Return, " Pass Fail " + TestContext.CurrentContext.Test.Name);
            Assert.AreEqual(Expected, Actual, TestContext.CurrentContext.Test.Name);
        }
        public void BattleEngine_AddCharacter_No_Characters_In_ViewModel_Should_Fail()
        {
            // Set a new Battle Engine
            // Create new Characters, 6 is the default

            // Arrange
            var myEngine = new BattleEngine();

            // Clear the characters in the view model, to cause the list to pull from to be empty
            MockForms.Init();   //ViewModels need to Mock because of the calls to the messages
            CharactersViewModel.Instance.Dataset.Clear();

            bool Expect = false;

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

            // Changed system state, so need to restore it.
            CharactersViewModel.Instance.ForceDataRefresh();

            // Assert
            Assert.AreEqual(Expect, Actual, TestContext.CurrentContext.Test.Name);
        }
Exemple #10
0
        public void BattleEngine_AddCharactersToBattle_With_Empty_CharacterListView_Should_Fail()
        {
            MockForms.Init();

            // Can create a new battle engine...
            var myBattleEngine = new BattleEngine();

            // Clear the dataset...
            CharactersViewModel.Instance.Dataset.Clear();

            var Return = myBattleEngine.AddCharactersToBattle();

            var Actual   = myBattleEngine.CharacterList.Count;
            var Expected = 0;

            // Reset
            var myCharacterViewModel = CharactersViewModel.Instance;
            var canExecute           = myCharacterViewModel.LoadDataCommand.CanExecute(null);

            myCharacterViewModel.LoadDataCommand.Execute(null);

            Assert.AreEqual(false, Return, " Pass Fail " + TestContext.CurrentContext.Test.Name);
            Assert.AreEqual(Expected, Actual, TestContext.CurrentContext.Test.Name);
        }