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

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

            var expectedSight = testWeapon.GetCurrentSight();

            Assert.AreEqual(expectedSight.accuracyMultiplier, new Sight(SightEnum.LaserSight).accuracyMultiplier);
        }
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 TestToggleSightsWithOneSight()
        {
            AssaultRifle testWeapon = new AssaultRifle();

            testWeapon.AddSight(SightEnum.LaserSight);

            var toggleSightResult = testWeapon.ToggleSight();

            Assert.IsFalse(toggleSightResult);
        }
Example #4
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);
        }