public void Equipment_UseByName_InvalidNAmeBlows() { Assert.Throws <BdBaseException>(() => { var sut = new MockBotFactory().CreateBasicMockBot().WithItemSupport().WithMockActionProvider().ToBot(); var ai = sut.InstallEquipment(KnownEquipmentIds.MOCKINSTALLEVERYWHERE, "DummyUseEquipment1", MountPoint.Internal); var result = sut.UseEquipment("monkey fish"); }); }
public void Equipment_UseByGuid_Works() { var sut = new MockBotFactory().CreateBasicMockBot().WithItemSupport().WithMockActionProvider().ToBot(); var ai = sut.InstallEquipment(KnownEquipmentIds.MOCKINSTALLEVERYWHERE, "DummyUseEquipment1", MountPoint.Internal); var result = sut.UseEquipment(ai.InstanceId); Assert.True(result.State == UsageEndState.Success, "The usage must be a success"); }
public void Equipment_UseWithInvalidGuid_Blows() { Assert.Throws <BdBaseException>(() => { Guid g = Guid.NewGuid(); var sut = new MockBotFactory().CreateBasicMockBot().ToBot(); sut.UseEquipment(g); }); }
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); }