public void Equipment_InstallDuplicateName_Blows() { Assert.Throws <BdBaseException>(() => { var sut = new MockBotFactory().CreateBasicMockBot().WithMockActionProvider().WithItemSupport().ToBot(); sut.InstallEquipment(KnownEquipmentIds.MOCKINSTALLEVERYWHERE, "FriendlyName", MountPoint.Internal); sut.InstallEquipment(KnownEquipmentIds.MOCKINSTALLEVERYWHERE, "FriendlyName", MountPoint.Internal); }); }
public void Equipment_MountTwoPowerpacks_SecondFails() { var sut = new MockBotFactory().CreateBasicMockBot().WithMockActionProvider().WithItemSupport().ToBot(); var r1 = sut.InstallEquipment(KnownEquipmentIds.MOCKPOWERPACK, "PP1", MountPoint.Internal); var r2 = sut.InstallEquipment(KnownEquipmentIds.MOCKPOWERPACK, "PP2", MountPoint.Internal); Assert.NotNull(r1); Assert.Null(r2); }
public void Equipment_InstallBadIdentity_Blows() { Assert.Throws <BdBaseException>(() => { var sut = new MockBotFactory().CreateBasicMockBot().ToBot(); sut.InstallEquipment(-1, "FriendlyName", MountPoint.Internal); }); }
public void Equipment_InstallNoPrepare_Blows() { Assert.Throws <BdBaseException>(() => { var sut = new MockBotFactory().CreateBasicMockBot().ToBot(); sut.InstallEquipment(KnownEquipmentIds.MOCKINSTALLEVERYWHERE, "FriendlyName", MountPoint.Internal); }); }
public void Scanner_MockScannerIsInternalInstallOnly() { var sut = new MockBotFactory().CreateBasicMockBot().WithMockActionProvider().WithItemSupport().ToBot(); EquipmentInstallationResult ae = sut.InstallEquipment(KnownEquipmentIds.MOCKSCANNER, "FriendlyName", MountPoint.Internal); Assert.True(ae.InstanceId != Guid.Empty, "The scanner must be installed successfully"); }
public void Equipment_InstallWrongExternal_ReturnsCorrectError() { var sut = new MockBotFactory().CreateBasicMockBot().WithMockActionProvider().WithItemSupport().ToBot(); var kit = sut.InstallEquipment(KnownEquipmentIds.MOCKINSTALLINTERNALONLY, "Teste Equipment1", MountPoint.Forward); Assert.NotNull(kit); Assert.Equal(InstallationResult.Fail_InvalidMountpoint, kit.Result); }
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_GtePowerpack_GetsPowerpack() { var sut = new MockBotFactory().CreateBasicMockBot().WithMockActionProvider().WithItemSupport().ToBot(); sut.InstallEquipment(KnownEquipmentIds.MOCKPOWERPACK, "PP", MountPoint.Internal); var pp = sut.GetPowerPack(); Assert.NotNull(pp); Assert.True(pp.EquipmentId == KnownEquipmentIds.MOCKPOWERPACK, "The wrong equipment was installed"); }
public void Equipment_TooBigForTurrent_FailsToInstall() { var sut = new MockBotFactory().CreateBasicMockBot().WithMockActionProvider().WithItemSupport().ToBot(); var kit = sut.InstallEquipment(KnownEquipmentIds.MOCKWAYTOOBIG, "Test Equipment1", MountPoint.Turret); BasicMockBot bmb = (BasicMockBot)sut; Assert.NotNull(kit); Assert.Equal(InstallationResult.Fail_NoSpace, kit.Result); }
public void Equipment_Install_AddsToCount() { var sut = new MockBotFactory().CreateBasicMockBot().WithMockActionProvider().WithItemSupport().ToBot(); BasicMockBot bmb = (BasicMockBot)sut; int preInstall = bmb.GetEquipmentCount(); var kit = sut.InstallEquipment(KnownEquipmentIds.MOCKINSTALLEVERYWHERE, "Teste Equipment1", MountPoint.Internal); int postInstall = bmb.GetEquipmentCount(); Assert.Equal(preInstall + 1, postInstall); }
public void Equipment_Install_ReturnsSuccess() { var sut = new MockBotFactory().CreateBasicMockBot().WithMockActionProvider().WithItemSupport().ToBot(); BasicMockBot bmb = (BasicMockBot)sut; int preInstall = bmb.GetEquipmentCount(); var kit = sut.InstallEquipment(KnownEquipmentIds.MOCKINSTALLEVERYWHERE, "Teste Equipment1", MountPoint.Internal); Assert.NotNull(kit); Assert.Equal(InstallationResult.Installed, kit.Result); }
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); }