public void TestAddingMultipleBarrels() { AssaultRifle testWeapon = new AssaultRifle(); testWeapon.AddBarrel(BarrelEnum.LongBarrel); testWeapon.AddBarrel(BarrelEnum.MediumBarrel); var expectedBarrel = testWeapon.GetCurrentBarrel(); Assert.AreEqual(expectedBarrel.damageMultiplier, new Barrel(BarrelEnum.MediumBarrel).damageMultiplier); }
public void TestRemoveBarrelWhenInventoryIsNotTogglable() { //test exists to make sure remove barrel manually updates current index because toggle does not work on barrel collections with count of 2 AssaultRifle testWeapon = new AssaultRifle(); testWeapon.AddBarrel(BarrelEnum.LongBarrel); testWeapon.AddBarrel(BarrelEnum.MediumBarrel); testWeapon.RemoveBarrel(); var expectedCurrentBarrelIndex = testWeapon.CurrentBarrelIndex; Assert.AreEqual(expectedCurrentBarrelIndex, ModdableWeapon.StartingBarrelIndex); }
public void TestToggleBarrelsWithOneBarrel() { AssaultRifle testWeapon = new AssaultRifle(); testWeapon.AddBarrel(BarrelEnum.LongBarrel); var toggleBarrelResult = testWeapon.ToggleBarrel(); Assert.IsFalse(toggleBarrelResult); }
public void TestRemoveBarrelWhenInventoryIsTogglable() { AssaultRifle testWeapon = new AssaultRifle(); BarrelEnum[] barrelEnumArray = { BarrelEnum.ShortBarrel, BarrelEnum.LongBarrel, BarrelEnum.MediumBarrel, BarrelEnum.ShortBarrel, BarrelEnum.LongBarrel, BarrelEnum.MediumBarrel }; foreach (var barrelEnum in barrelEnumArray) { testWeapon.AddBarrel(barrelEnum); } testWeapon.RemoveBarrel(); var actualBarrelIndex = testWeapon.CurrentBarrelIndex; var expectedBarrelIndex = barrelEnumArray.Length - 1; Assert.AreEqual(expectedBarrelIndex, actualBarrelIndex); }