Exemple #1
0
        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);
        }
Exemple #2
0
        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);
        }
Exemple #3
0
        public void TestToggleBarrelsWithOneBarrel()
        {
            AssaultRifle testWeapon = new AssaultRifle();

            testWeapon.AddBarrel(BarrelEnum.LongBarrel);

            var toggleBarrelResult = testWeapon.ToggleBarrel();

            Assert.IsFalse(toggleBarrelResult);
        }
Exemple #4
0
        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);
        }