public static mockBd2Engine SetupForPowerTests() { var bot = new MockBotFactory().CreateBasicMockBot().WithEquipmentCallback(ab => { ab.InstallEquipment(KnownEquipmentIds.MOCKPOWERPACK, "PP", MountPoint.Internal); }).ToBot(); var tef = new TestEngineFactory().WithDefaultWorld().WithBot(bot).WithBotSupport().WithEquipmentSupport(); var sut = tef.ToMockEngine(); sut.RegisterForMessages(); PowerPackEquipmentItem ppi = (PowerPackEquipmentItem)tef.EngineSuppliedEquipmentSupport.GetEquipmentTypeById(KnownEquipmentIds.MOCKPOWERPACK); sut.StartBattle(); return sut; }
private ScanEquipmentUseResult GetDefinedScanResult(int definedResult, bool includeSecondBot = false) { Hub testHub = new Hub(); var scanningBot = new MockBotFactory().CreateBasicMockBot().WithMockPack().ToBot(); var scannedBot = new MockBotFactory().CreateBasicMockBot().WithMockPack().ToBot(); TestEngineFactory tef = new TestEngineFactory().WithHub(testHub).WithDefaultWorld().WithEquipmentSupport().WithBotSupport().WithBot(scanningBot); if (includeSecondBot) { tef = tef.WithBot(scannedBot); } var engx = tef.WithPrepare().ToMockEngine(); engx.PerformNextTick(); engx.Mock_DirectSetBotLocation(scanningBot.PublicId, new Point(99, 99)); // Set bot to top right of the map. if (includeSecondBot) { engx.Mock_DirectSetBotLocation(scannedBot.PublicId, new Point(97, 99)); // Set bot to top right of the map. } bd2Engine ee = (bd2Engine)engx; var ae = scanningBot.InstallEquipment(KnownEquipmentIds.MOCKSCANNER, "FriendlyName", MountPoint.Internal); engx.Mock_DirectSetBotCharge(scanningBot.PublicId, 100); var result = scanningBot.UseEquipment(ae.InstanceId); ScanEquipmentUseResult resASR = (ScanEquipmentUseResult)result; Assert.Equal <UsageEndState>(UsageEndState.Success, resASR.State); return(resASR); }