Beispiel #1
0
        public void WeaponRepository_CreateNewWeapon_ShouldCreateWeaponBasedOnInputEnum()
        {
            var weaponType = WeaponType.Axe;

            var actual = _repo.CreateNewWeapon(weaponType);

            Assert.IsInstanceOfType(actual, typeof(Weapon));
            Assert.IsInstanceOfType(actual, typeof(Axe));
        }
        private void SelectWeapon()
        {
            _console.Clear();
            if (_player is null)
            {
                _console.WriteLine("Create a Character First");
                _console.ReadKey();
                MainMenu();
            }

            _console.WriteLine("Choose your weapon\n1. Axe\n2. Hammer\n3. Sword");

            switch (ParseInput())
            {
            case 1:
                _player.Weapon = _weaponRepo.CreateNewWeapon(WeaponType.Axe);
                break;

            case 2:
                _player.Weapon = _weaponRepo.CreateNewWeapon(WeaponType.Hammer);
                break;

            case 3:
                _player.Weapon = _weaponRepo.CreateNewWeapon(WeaponType.Sword);
                break;

            case 4:
                _player.Weapon = _weaponRepo.CreateNewWeapon(WeaponType.AR15);
                break;

            default:
                _console.WriteLine("Enter Valid Input");
                _console.ReadKey();
                SelectWeapon();
                break;
            }
        }