Ejemplo n.º 1
0
        public void RunOnZoningSetsZoneToNewZone()
        {
            // Fixture setup
            var api    = new FakeMemoryAPI();
            var player = new FakePlayer
            {
                Zone  = Zone.Konschtat_Highlands,
                Stats = new Structures.PlayerStats {
                    Str = 100
                }
            };

            var navigation = new Mock <INavigatorTools>();

            api.Player    = player;
            api.Navigator = navigation.Object;
            var sut = new ZoneState(api);

            player.Zone = Zone.Valkurm_Dunes;

            // Exercise system
            sut.Run();

            // Verify outcome
            Assert.Equal(Zone.Valkurm_Dunes, sut.Zone);

            // Teardown
        }
Ejemplo n.º 2
0
            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
            }
Ejemplo n.º 3
0
        private Executor CreateSut()
        {
            var memory = new FakeMemoryAPI();
            var sut    = new Executor(memory);

            return(sut);
        }
Ejemplo n.º 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
            }
Ejemplo n.º 5
0
            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
            }
Ejemplo n.º 6
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
            }
Ejemplo n.º 7
0
        public void RunOnZoningStopsPlayerFromRunning()
        {
            // Fixture setup
            var api    = new FakeMemoryAPI();
            var player = new FakePlayer
            {
                Zone  = Zone.Konschtat_Highlands,
                Stats = new Structures.PlayerStats {
                    Str = 100
                }
            };

            var navigation = new Mock <INavigatorTools>();

            navigation.Setup(x => x.Reset());
            api.Player    = player;
            api.Navigator = navigation.Object;
            var sut = new ZoneState(api);

            player.Zone = Zone.Valkurm_Dunes;

            // Exercise system
            sut.Run();

            // Verify outcome
            navigation.Verify(x => x.Reset(), Times.Once());

            // Teardown
        }
Ejemplo n.º 8
0
        public IMemoryAPI FindMemoryApi()
        {
            var memoryApi = new FakeMemoryAPI();

            memoryApi.Player = _player;
            memoryApi.Timer  = _timer;
            return(memoryApi);
        }
Ejemplo n.º 9
0
            private BattleState CreateSut(FakeNavigator navigator)
            {
                var memory = new FakeMemoryAPI()
                {
                    Navigator = navigator,
                    Player    = FindPlayer()
                };

                return(new BattleState(new StateMemory(memory)));
            }
Ejemplo n.º 10
0
        public void IsRecastableWhenNotOnRecast(AbilityType abilityType)
        {
            ability.AbilityType = abilityType;
            var memoryApi = new FakeMemoryAPI();

            memoryApi.Timer = new FakeTimer();
            var result = AbilityUtils.IsRecastable(memoryApi, ability);

            Assert.True(result);
        }
Ejemplo n.º 11
0
        private Executor CreateSut(FakeWindower windower, FakePlayer player)
        {
            var memory = new FakeMemoryAPI();

            memory.Player   = player;
            memory.Windower = windower;

            var sut = new Executor(memory);

            return(sut);
        }
Ejemplo n.º 12
0
        public void NotRecastableWhenOnRecast(AbilityType abilityType)
        {
            ability.AbilityType = abilityType;
            var memoryApi = new FakeMemoryAPI();

            memoryApi.Timer = new FakeTimer()
            {
                ActionRecast = 1
            };
            var result = AbilityUtils.IsRecastable(memoryApi, ability);

            Assert.False(result);
        }
Ejemplo n.º 13
0
            private static BattleState CreateSut(FakeWindower windower, FakePlayer player)
            {
                var navigator = FindNavigator();

                var memory = new FakeMemoryAPI()
                {
                    Windower  = windower,
                    Player    = player,
                    Navigator = navigator
                };

                return(new BattleState(new StateMemory(memory)));
            }
Ejemplo n.º 14
0
        private Executor CreateSut(
            FakeWindower windower,
            FakePlayer player,
            FakeNavigator navigator,
            FakeTarget target)
        {
            var memory = new FakeMemoryAPI();

            memory.Player    = player;
            memory.Windower  = windower;
            memory.Navigator = navigator;
            memory.Target    = target;

            var sut = new Executor(memory);

            return(sut);
        }
Ejemplo n.º 15
0
            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
            }
Ejemplo n.º 16
0
        public void RunWhileZoningWaits()
        {
            // Fixture setup
            var api    = new FakeMemoryAPI();
            var player = new FakePlayer
            {
                Zone  = Zone.Konschtat_Highlands,
                Stats = new Structures.PlayerStats {
                    Str = 0
                }
            };

            var navigation = new Mock <INavigatorTools>();

            navigation.Setup(x => x.Reset());
            api.Player    = player;
            api.Navigator = navigation.Object;
            var sut = new ZoneState(api)
            {
                ZoningAction = () =>
                {
                    player.Stats = new Structures.PlayerStats
                    {
                        Str = 100
                    };
                }
            };

            player.Zone = Zone.Valkurm_Dunes;

            // Exercise system
            sut.Run();

            // Verify outcome
            Assert.Equal(100, player.Stats.Str);

            // Teardown
        }
Ejemplo n.º 17
0
        public void CheckIsTrueWhenPlayersStatsAreZero()
        {
            // Fixture setup
            var api    = new FakeMemoryAPI();
            var player = new FakePlayer
            {
                Zone  = Zone.Konschtat_Highlands,
                Stats = new Structures.PlayerStats {
                    Str = 0
                }
            };

            api.Player = player;
            var sut = new ZoneState(new StateMemory(api));

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

            // Verify outcome
            Assert.True(result);

            // Teardown
        }
Ejemplo n.º 18
0
            private static BattleState CreateSut(FakeWindower windower)
            {
                var player    = FindPlayer();
                var navigator = FindNavigator();
                var target    = FindTarget();
                var timer     = FindTimer();

                var memory = new FakeMemoryAPI()
                {
                    Player    = player,
                    Windower  = windower,
                    Navigator = navigator,
                    Target    = target,
                    Timer     = timer
                };

                var sut = new BattleState(new StateMemory(memory)
                {
                    Target = FindUnit()
                });

                return(sut);
            }
Ejemplo n.º 19
0
        public void CheckIsFalseWhenNotZoning()
        {
            // Fixture setup
            var api    = new FakeMemoryAPI();
            var player = new FakePlayer
            {
                Zone  = Zone.Konschtat_Highlands,
                Stats = new Structures.PlayerStats {
                    Str = 100
                }
            };

            api.Player = player;
            var sut = new ZoneState(api);;

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

            // Verify outcome
            Assert.False(result);

            // Teardown
        }
Ejemplo n.º 20
0
        public void CheckIsTrueWhenZoneChanges()
        {
            // Fixture setup
            var api    = new FakeMemoryAPI();
            var player = new FakePlayer {
                Zone = Zone.Konschtat_Highlands
            };

            api.Player = player;
            var sut = new ZoneState(api);

            player.Zone  = Zone.Valkurm_Dunes;
            player.Stats = new Structures.PlayerStats {
                Str = 100
            };

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

            // Verify outcome
            Assert.True(result);

            // Teardown
        }