Example #1
0
        public void TestRemoveSightWithEmptyInventory()
        {
            AssaultRifle testWeapon = new AssaultRifle();

            //remove Sight returns false when the inventory is empty
            var removeSightResult = testWeapon.RemoveSight();


            Assert.IsFalse(removeSightResult);
        }
Example #2
0
        public void TestRemoveSightWhenInventoryIsNotTogglable()
        {
            //test exists to make sure remove Sight manually updates current index because toggle does not work on Sight collections with count of 2
            AssaultRifle testWeapon = new AssaultRifle();


            testWeapon.AddSight(SightEnum.LaserSight);
            testWeapon.AddSight(SightEnum.ReflexSight);
            testWeapon.RemoveSight();


            var expectedCurrentSightIndex = testWeapon.CurrentSightIndex;

            Assert.AreEqual(expectedCurrentSightIndex, ModdableWeapon.StartingSightIndex);
        }
Example #3
0
        public void TestRemoveSightWhenInventoryIsTogglable()
        {
            AssaultRifle testWeapon = new AssaultRifle();

            SightEnum[] SightEnumArray = { SightEnum.ZoomSight, SightEnum.LaserSight, SightEnum.ReflexSight, SightEnum.ZoomSight, SightEnum.LaserSight, SightEnum.ReflexSight };
            foreach (var SightEnum in SightEnumArray)
            {
                testWeapon.AddSight(SightEnum);
            }

            testWeapon.RemoveSight();

            var actualSightIndex   = testWeapon.CurrentSightIndex;
            var expectedSightIndex = SightEnumArray.Length - 1;

            Assert.AreEqual(expectedSightIndex, actualSightIndex);
        }