public void AmeisenBotStateMachineCombatEngineTest()
        {
            TestWowDataAdapter wowDataAdapter = new TestWowDataAdapter();

            AmeisenBotStateMachine stateMachine = new AmeisenBotStateMachine(
                wowDataAdapter,
                new TestWowActionExecutor(),
                null,
                new BasicMeleeMovementProvider(),
                new TestSpellStrategy()
                );

            Assert.IsTrue(stateMachine.CurrentState is BotStateIdle);

            wowDataAdapter.SetMeInCombat(true);
            stateMachine.CurrentState.Execute();
            Assert.IsTrue(stateMachine.CurrentState is BotStateCombat);

            stateMachine.CurrentState.Execute();
            stateMachine.CurrentState.Execute();
            stateMachine.CurrentState.Execute();

            Assert.IsTrue(stateMachine.CurrentState is BotStateCombat);

            wowDataAdapter.SetMeInCombat(false);
            stateMachine.CurrentState.Execute();
            Assert.IsTrue(stateMachine.CurrentState is BotStateIdle);
        }
        public void IsMeInCombatTest()
        {
            TestWowDataAdapter wowDataAdapter = new TestWowDataAdapter();

            AmeisenBotStateMachine stateMachine = new AmeisenBotStateMachine(
                wowDataAdapter,
                new TestWowActionExecutor(),
                null,
                new BasicMeleeMovementProvider(),
                new TestSpellStrategy()
                );

            Assert.IsFalse(stateMachine.IsMeInCombat());
            wowDataAdapter.SetMeInCombat(true);
            Assert.IsTrue(stateMachine.IsMeInCombat());
            wowDataAdapter.SetMeInCombat(false);
            Assert.IsFalse(stateMachine.IsMeInCombat());
        }
        public void AmeisenBotStateMachineTransitionIdleToFollowTest()
        {
            TestWowDataAdapter wowDataAdapter = new TestWowDataAdapter();

            AmeisenBotStateMachine stateMachine = new AmeisenBotStateMachine(
                wowDataAdapter,
                new TestWowActionExecutor(),
                null,
                null,
                null
                );

            Assert.IsTrue(stateMachine.CurrentState is BotStateIdle);
            stateMachine.CurrentState.Execute();
            Assert.IsTrue(stateMachine.CurrentState is BotStateFollow);
            stateMachine.CurrentState.Execute();
            ((BotStateFollow)stateMachine.CurrentState).UnitToFollow = null;
            stateMachine.CurrentState.Execute();
            Assert.IsTrue(stateMachine.CurrentState is BotStateIdle);
        }
        public void AmeisenBotStateMachineTest()
        {
            IWowDataAdapter    wowDataAdapter    = new TestWowDataAdapter();
            IWowActionExecutor wowActionExecutor = new TestWowActionExecutor();

            AmeisenBot ameisenBot = new AmeisenBot(null, wowDataAdapter, null, null);

            ameisenBot.Attach(wowActionExecutor, null, null, new BasicMeleeMovementProvider(), null);

            AmeisenBotStateMachine stateMachine = new AmeisenBotStateMachine(ameisenBot.WowDataAdapter, ameisenBot.WowActionExecutor, null, null, null);

            Assert.IsTrue(stateMachine.CurrentState is BotStateIdle);

            stateMachine.SwitchState(typeof(BotStateFollow));
            Assert.IsTrue(stateMachine.CurrentState is BotStateFollow);

            Assert.AreEqual("You suck", wowDataAdapter.LastErrorMessage);

            wowDataAdapter.StartObjectUpdates();
            wowDataAdapter.StopObjectUpdates();
        }
Пример #5
0
 public void AmeisenBotSetup()
 {
     TestWowDataAdapter adapter = new TestWowDataAdapter();
     AmeisenBot         bot     = new AmeisenBot(null, adapter, null, null);
 }
Пример #6
0
        public void Setup()
        {
            TestWowDataAdapter dataAdapter = new TestWowDataAdapter();

            ameisenBot = new AmeisenBot(null, dataAdapter, null, null);
        }
Пример #7
0
        public void CompareItemsTest()
        {
            TestWowDataAdapter       dataAdapter = new TestWowDataAdapter();
            BasicItemLevelComparator basicItemLevelComparator = new BasicItemLevelComparator(dataAdapter);

            RawItem rawItem1 = new RawItem
            {
                cooldownEnd   = "0",
                cooldownStart = "0",
                count         = "1",
                curDurability = "100",
                equiplocation = "INVSLOT_HEAD",
                id            = "4712",
                level         = "85",
                link          = "...",
                maxDurability = "100",
                maxStack      = "1",
                minLevel      = "60",
                name          = "Ultra Rubbish Bin",
                quality       = "2",
                sellprice     = "1250",
                subtype       = "Plate",
                type          = "armor"
            };

            RawItem rawItem2 = new RawItem
            {
                cooldownEnd   = "0",
                cooldownStart = "0",
                count         = "1",
                curDurability = "100",
                equiplocation = "INVSLOT_HEAD",
                id            = "4713",
                level         = "65",
                link          = "...",
                maxDurability = "100",
                maxStack      = "1",
                minLevel      = "40",
                name          = "Ultra Rubbish Cowl",
                quality       = "2",
                sellprice     = "1250",
                subtype       = "Cloth",
                type          = "armor"
            };

            RawItem rawItem3 = new RawItem
            {
                cooldownEnd   = "0",
                cooldownStart = "0",
                count         = "1",
                curDurability = "100",
                equiplocation = "INVSLOT_HEAD",
                id            = "4714",
                level         = "5",
                link          = "...",
                maxDurability = "100",
                maxStack      = "1",
                minLevel      = "40",
                name          = "Rubbish Cowl",
                quality       = "2",
                sellprice     = "1250",
                subtype       = "Cloth",
                type          = "armor"
            };

            IItem resultItem1 = ItemFactory.BuildSpecificItem(rawItem1);
            IItem resultItem2 = ItemFactory.BuildSpecificItem(rawItem2);
            IItem resultItem3 = ItemFactory.BuildSpecificItem(rawItem3);

            Assert.IsInstanceOfType(resultItem1, typeof(ArmorItem));
            Assert.IsInstanceOfType(resultItem2, typeof(ArmorItem));
            Assert.IsInstanceOfType(resultItem3, typeof(ArmorItem));

            Assert.IsFalse(basicItemLevelComparator.CompareItems(resultItem1, resultItem3));
            Assert.IsTrue(basicItemLevelComparator.CompareItems(resultItem2, resultItem3));
        }