private ISpaceShip SpaceShipWithTwoFunctionalWeaponStubs() { var spaceship = new SpaceShip(2, 0); spaceship.Equip(new FunctionalWeaponStub()); spaceship.Equip(new FunctionalWeaponStub()); return spaceship; }
private static SpaceShip SpaceShipWithTwoFunctionalWeaponStubs() { var spaceShip = new SpaceShip(2, 0); spaceShip.Equip(new FunctionalWeaponStub()); spaceShip.Equip(new FunctionalWeaponStub()); return(spaceShip); }
public void NoWeaponSlotsAvailable_AfterWeaponIsEquiped() { // Arrange SpaceShip spaceShip = SpaceShipWithSingleWeaponSlot(); IWeapon weapon = new DummyWeapon(); // Act spaceShip.Equip(weapon); // Assert var noWeaponSlotsAvailable = spaceShip.AvailableWeaponSlots == 0; Assert.That(noWeaponSlotsAvailable); }
public void NoWeaponSlotsAvailable_AfterWeaponIsEquiped2() { // Arrange. SpaceShip spaceShip = SpaceShipWithSingleWeaponSlot(); IWeapon weapon = NSubstitute.Substitute.For <IWeapon>(); // Act. spaceShip.Equip(weapon); // Assert. bool noWeaponSlotsAvailable = 0 == spaceShip.AvailableWeaponSlots; Assert.True(noWeaponSlotsAvailable); }
public void EachWeaponShoots_WhenSpaceShipShootIsCalled() { // Arrange var weapon1 = Substitute.For<IWeapon>(); var weapon2 = Substitute.For<IWeapon>(); var ship = new SpaceShip(2, 0); ship.Equip(weapon1); ship.Equip(weapon2); // Act ship.Shoot(); // Assert weapon1.Received(1).Shoot(); weapon2.Received(1).Shoot(); }
public void EachWeaponShoots_WhenSpaceShipShootIsCalled() { // Arrange. var weapon1 = Substitute.For <IWeapon>(); var weapon2 = Substitute.For <IWeapon>(); var spaceShip = new SpaceShip(2, 0); spaceShip.Equip(weapon1); spaceShip.Equip(weapon2); // Act. spaceShip.Shoot(); // Assert. weapon1.Received(1).Shoot(); weapon2.Received(1).Shoot(); }
public void EachWeaponGetsReloaded_AfterItIsShot() { // Arrange var weapon1 = Substitute.For<IWeapon>(); var weapon2 = Substitute.For<IWeapon>(); var ship = new SpaceShip(2, 0); ship.Equip(weapon1); ship.Equip(weapon2); // Act ship.Shoot(); // Assert Received.InOrder(() => { weapon1.Shoot(); weapon2.Shoot(); weapon1.Reload(); weapon2.Reload(); } ); }
public void EachWeaponGetsReloaded_AfterItIsShot() { // Arrange var weapon1 = Substitute.For <IWeapon>(); var weapon2 = Substitute.For <IWeapon>(); var ship = new SpaceShip(2, 0); ship.Equip(weapon1); ship.Equip(weapon2); // Act ship.Shoot(); // Assert Received.InOrder(() => { weapon1.Shoot(); weapon2.Shoot(); weapon1.Reload(); weapon2.Reload(); } ); }
private static SpaceShip SpaceShipWithSingleWeaponSlot() { SpaceShip spaceShip = new SpaceShip(1, 0); return(spaceShip); }
private static SpaceShip SpaceShipWithSingleWeaponSlot() { SpaceShip spaceShip = new SpaceShip(1, 0); return spaceShip; }