Пример #1
0
        public void CalcWeightTest()
        {
            // Arrange
            WeaponStorage weaponstorage = new WeaponStorage();
            Weapon        weapon        = new Weapon(WeaponType.Gravity);

            // Act
            weaponstorage.AddWeapon(weapon);
            weapon          = new Weapon(WeaponType.JASSM);
            weapon.Quantity = 2;
            weaponstorage.AddWeapon(weapon);
            int expected = Weapon.GRAVITY_WEIGHT + Weapon.JASSM_WEIGHT * 2;
            int actual   = weaponstorage.CalcWeight();

            // Assert
            Assert.AreEqual(actual, expected);
        }
Пример #2
0
        public void ClearWeaponTest()
        {
            // Arrange
            WeaponStorage weaponstorage = new WeaponStorage();
            Weapon        weapon        = new Weapon(WeaponType.Gravity);

            // Act
            weaponstorage.AddWeapon(weapon);
            weapon          = new Weapon(WeaponType.JASSM);
            weapon.Quantity = 2;
            weaponstorage.AddWeapon(weapon);
            weaponstorage.ClearWeapon();
            int actual   = weaponstorage.Storage.Count();
            int expected = 0;

            // Assert
            Assert.AreEqual(actual, expected);
        }
Пример #3
0
        public void AddWeaponTest()
        {
            // Arrange
            WeaponStorage weaponstorage = new WeaponStorage();
            Weapon        gravity       = new Weapon(WeaponType.Gravity);

            // Act
            weaponstorage.AddWeapon(gravity);
            bool expected = true;
            bool actual   = weaponstorage.Contain(gravity);

            // Assert
            Assert.AreEqual(actual, expected);
        }
Пример #4
0
        public void ToStringTest()
        {
            // Arrange
            WeaponStorage weaponstorage = new WeaponStorage();
            Weapon        gravity       = new Weapon(WeaponType.Gravity);

            // Act
            weaponstorage.AddWeapon(gravity);
            String expected = "1 Gravity";
            String actual   = weaponstorage.ToString();

            // Assert
            Assert.AreEqual(actual, expected);
        }
 public IActionResult AddWeapon(Weapons weapon)
 {
     return(Ok(_wpStorage.AddWeapon(weapon)));
 }