Example #1
0
        public void GivenAWeaponName_ACostPropertyIsAssigned(string equipName, double expectedCost)
        {
            // Arrange
            Weapon weapon = new Weapon();

            // Act
            Equipment.Equipment builtWeapon = weapon.BuildWeapon(equipName);
            var actualCost = builtWeapon.Cost;

            // Assert
            Assert.AreEqual(expectedCost, actualCost);
        }
Example #2
0
        private void addWeaponButton_Click(object sender, EventArgs e)
        {
            Weapon weapon = new Weapon();
            Weapon shinyWeapon = weapon.BuildWeapon(weaponOneComboBox.SelectedItem.ToString());

            if ((weaponOneComboBox.SelectedItem == null) || (!((Player.PlayerClass.Gold - shinyWeapon.Cost) >= 0)))
            {
                MessageBox.Show(Broke);
                weaponOneComboBox.ResetText();
            }
            else
            {
                TotalWeight = TotalWeight + shinyWeapon.Weight;
                DisplayLoadAndWeight();
                Player.PlayerClass.Gold = Player.PlayerClass.Gold - shinyWeapon.Cost;
                goldTextBox.Text = Player.PlayerClass.Gold.ToString();
                weaponListBox.Items.Add(weaponOneComboBox.Text);
            }
        }
Example #3
0
 private void removeWeaponButton_Click(object sender, EventArgs e)
 {
     Weapon weapon = new Weapon();
     if (weaponListBox.SelectedItem != null)
     {
         Weapon removedWeapon = weapon.BuildWeapon(weaponListBox.SelectedItem.ToString());
         TotalWeight = TotalWeight - removedWeapon.Weight;
         DisplayLoadAndWeight();
         Player.PlayerClass.Gold = Player.PlayerClass.Gold + removedWeapon.Cost;
         weaponListBox.Items.Remove(weaponListBox.SelectedItem);
     }
     totalWeightTextBox.Text = TotalWeight.ToString();
     goldTextBox.Text = Player.PlayerClass.Gold.ToString();
 }
Example #4
0
 private void weaponOneComboBox_SelectedIndexChanged(object sender, EventArgs e)
 {
     Weapon weapon = new Weapon();
     Weapon playerWeapon = weapon.BuildWeapon(weaponOneComboBox.SelectedItem.ToString());
     DisplayWeaponOne(playerWeapon);
 }