示例#1
0
        public void WhenEngagedSetAndEngagedShouldBattle()
        {
            // Fixture setup
            context.Config.IsEngageEnabled = true;
            context.Player.Status          = Status.Fighting;
            context.IsFighting             = true;
            context.Target = FindUnit();
            // Exercise system
            bool result = sut.Check(context);

            // Verify outcome
            Assert.True(result);
            // Teardown
        }
            public void WhenInjuredShouldntBattle()
            {
                // Fixture setup
                var player = FindPlayer();

                player.HPPCurrent               = 25;
                Config.Instance.LowHealth       = 50;
                Config.Instance.HighHealth      = 100;
                Config.Instance.IsHealthEnabled = true;
                player.Status = Status.Standing;

                CombatState.IsFighting          = true;
                Config.Instance.IsEngageEnabled = false;
                CombatState.Target = FindUnit();

                var memory = new FakeMemoryAPI {
                    Player = player
                };
                var sut = new BattleState(memory);

                UnitService.Units = new List <IUnit>();

                // Exercise system
                var result = sut.Check();

                // Verify outcome
                Assert.False(result);

                // Teardown
            }
            public void WithInvalidTargetShouldntBattle()
            {
                // Fixture setup
                var player = FindPlayer();

                player.Status = Status.Standing;

                CombatState.IsFighting          = true;
                Config.Instance.IsEngageEnabled = false;
                CombatState.Target = FindNonValidUnit();

                var memory = new FakeMemoryAPI {
                    Player = player
                };
                var sut = new BattleState(memory);

                UnitService.Units = new List <IUnit>();

                // Exercise system
                var result = sut.Check();

                // Verify outcome
                Assert.False(result);

                // Teardown
            }
示例#4
0
            public void WithNonValidUnitShouldNotBattle()
            {
                // Fixture setup
                Config.Instance.IsEngageEnabled = false;

                var memory = new FakeMemoryAPI {
                    Player = FindPlayer()
                };

                var stateMemory = new StateMemory(memory)
                {
                    Target     = FindNonValidUnit(),
                    IsFighting = true
                };

                var sut = new BattleState(stateMemory);

                // Exercise system
                var result = sut.Check();

                // Verify outcome
                Assert.False(result);

                // Teardown
            }
示例#5
0
            public void WhenEngagedNotSetShouldBattle()
            {
                // Fixture setup
                Config.Instance.IsEngageEnabled = false;

                var memory = new FakeMemoryAPI();
                var player = FindPlayer();

                player.Status = Status.Standing;
                memory.Player = player;

                var stateMemory = new StateMemory(memory)
                {
                    Target     = FindUnit(),
                    IsFighting = true
                };

                var sut = new BattleState(stateMemory);

                // Exercise system
                var result = sut.Check();

                // Verify outcome
                Assert.True(result);

                // Teardown
            }
            public void WhenNotFightingShouldntBattle()
            {
                // Fixture setup
                MockConfig.IsEngageEnabled = false;
                StateMemory memory = CreateStateMemory();

                memory.Target     = FindUnit();
                memory.IsFighting = false;
                BattleState sut = new BattleState(memory);
                // Exercise system
                bool result = sut.Check();

                // Verify outcome
                Assert.False(result);
                // Teardown
            }
            public void WhenEngagedSetAndEngagedShouldBattle()
            {
                // Fixture setup
                MockConfig.IsEngageEnabled = true;
                MockEliteAPI.Player.Status = Status.Fighting;
                StateMemory memory = CreateStateMemory();

                memory.Target     = FindUnit();
                memory.IsFighting = true;
                BattleState sut = new BattleState(memory);
                // Exercise system
                bool result = sut.Check();

                // Verify outcome
                Assert.True(result);
                // Teardown
            }
            public void WithInvalidTargetShouldntBattle()
            {
                // Fixture setup
                StateMemory memory = CreateStateMemory(targetValid: false);

                memory.Target              = FindNonValidUnit();
                memory.IsFighting          = true;
                MockEliteAPI.Player.Status = Status.Standing;
                MockConfig.IsEngageEnabled = false;
                BattleState sut = new BattleState(memory);
                // Exercise system
                bool result = sut.Check();

                // Verify outcome
                Assert.False(result);
                // Teardown
            }
            public void WhenNotFightingShouldntBattle()
            {
                // Fixture setup
                CombatState.IsFighting          = false;
                CombatState.Target              = FindUnit();
                Config.Instance.IsEngageEnabled = false;
                var memory = new FakeMemoryAPI {
                    Player = FindPlayer()
                };
                var sut = new BattleState(memory);

                // Exercise system
                var result = sut.Check();

                // Verify outcome
                Assert.False(result);

                // Teardown
            }
            public void WhenInjuredShouldntBattle()
            {
                // Fixture setup
                StateMemory memory = CreateStateMemory();

                memory.Target     = FindUnit();
                memory.IsFighting = false;
                MockEliteAPI.Player.HPPCurrent = 25;
                MockEliteAPI.Player.Status     = Status.Standing;
                MockConfig.LowHealth           = 50;
                MockConfig.HighHealth          = 100;
                MockConfig.IsHealthEnabled     = true;
                MockConfig.IsEngageEnabled     = false;
                BattleState sut = new BattleState(memory);
                // Exercise system
                bool result = sut.Check();

                // Verify outcome
                Assert.False(result);
                // Teardown
            }