Пример #1
0
        public void Test_Constructor_GoodParameters()
        {
            GameItem         pointyStick      = ItemFactory.CreateGameItem(1001);
            AttackWithWeapon attackWithWeapon = new AttackWithWeapon(pointyStick, 1, 5);

            Assert.IsNotNull(attackWithWeapon);
        }
Пример #2
0
        public void Test_Constructor_GoodParametrs()
        {
            Item             pen = ItemFactory.CreateItem(1);
            AttackWithWeapon attackWithWeapon = new AttackWithWeapon(pen, 1, 5);

            Assert.IsNotNull(attackWithWeapon);
        }
Пример #3
0
        public void Test_Constructor_DamageDiceStringEmpty()
        {
            GameItem pointyStick = ItemFactory.CreateGameItem(1001);

            // This damage dice string must exist.
            // So, the constructor should throw an exception.
            AttackWithWeapon attackWithWeapon = new AttackWithWeapon(pointyStick, string.Empty);
        }
Пример #4
0
        public void Test_Constructor_ItemIsNotAWeapon()
        {
            GameItem granolaBar = ItemFactory.CreateGameItem(2001);

            // A granola bar is not a weapon.
            // So, the constructor should throw an exception.
            AttackWithWeapon attackWithWeapon = new AttackWithWeapon(granolaBar, "1d5");
        }
Пример #5
0
        public void Test_Constructor_MaximumDamageLessThanMinimumDamage()
        {
            GameItem pointyStick = ItemFactory.CreateGameItem(1001);

            // This maximum damage is less than the minimum damage.
            // So, the constructor should throw an exception.
            AttackWithWeapon attackWithWeapon = new AttackWithWeapon(pointyStick, 2, 1);
        }
Пример #6
0
        public void Test_Constructor_MinimumDamageLessThanZero()
        {
            var pointyStick = ItemFactory.CreateGameItem(1001);

            // This minimum damage value is less than 0.
            // So, the constructor should throw an exception.
            var attackWithWeapon = new AttackWithWeapon(pointyStick, -1, 5);
        }
        public void Test_Constructor_MaximumDamageLessThanMinimum()
        {
            GameItem pointyStick = ItemFactory.CreateGameItem(1001);

            //constructor should throw an exception as maximum damage cannot be less than minimum

            AttackWithWeapon attackWithWeapon = new AttackWithWeapon(pointyStick, 2, 1);
        }
Пример #8
0
 public GameItem(ItemCategory category, int itemTypeID, string name, int price, bool isUnique = false, AttackWithWeapon action = null)
 {
     Category   = category;
     ItemTypeID = itemTypeID;
     Name       = name;
     Price      = price;
     IsUnique   = isUnique;
     Action     = action;
 }
        public void Test_Constructor_ItemIsNotWeapon()
        {
            GameItem granolaBar = ItemFactory.CreateGameItem(2001);

            //granola bar is not a weapon
            //constructor should throw an exception

            AttackWithWeapon attackWithWeapon = new AttackWithWeapon(granolaBar, 1, 5);
        }
Пример #10
0
        public void Test_Constructor_MaximumDamageLessThanMinimumDamage()
        {
            var pointyStick = ItemFactory.CreateGameItem(1001);

            var attackWithWeapon = new AttackWithWeapon(pointyStick, 6, 5);
        }
Пример #11
0
        public void Test_Constructor_ItemIsNotAWeapon()
        {
            var granolaBar = ItemFactory.CreateGameItem(2001);

            var attackWithWeapon = new AttackWithWeapon(granolaBar, 1, 5);
        }
Пример #12
0
 public void Test_Constructor_MaxDMGLessThanMinDMG()
 {
     GameItem         pointyStick      = ItemFactory.CreateGameItem(1001);
     AttackWithWeapon attackWithWeapon = new AttackWithWeapon(pointyStick, 2, 1);
 }
Пример #13
0
 public void Test_Constructor_MinimumDamageLessThanZero()
 {
     GameItem         pointyStick      = ItemFactory.CreateGameItem(1001);
     AttackWithWeapon attackWithWeapon = new AttackWithWeapon(pointyStick, -1, 5);
 }
Пример #14
0
        public void Test_Constructor_MaxDamageLessThanMin()
        {
            Item pen = ItemFactory.CreateItem(1);

            _ = new AttackWithWeapon(pen, 2, 1);
        }
Пример #15
0
        public void Test_Constructor_MinDamageIsLessThanZero()
        {
            Item pen = ItemFactory.CreateItem(1);

            _ = new AttackWithWeapon(pen, -1, 5);
        }
Пример #16
0
        public void Test_Constructor_ItemIsNotAWeapon()
        {
            Item pen = ItemFactory.CreateItem(6);

            _ = new AttackWithWeapon(pen, 1, 5);
        }