public void ShouldCreateMonster() { Monster m = new Monster { MonsterId = MonsterDB.GetNextMonsterId(), Alive = true, Attack = 1, HP = 1, Name = "BenMonster" }; int amountInDb = MonsterDB.GetMonsters().Count; MonsterDB.InsertMonster(m); int amountInDbAfterInsert = MonsterDB.GetMonsters().Count; Assert.That(amountInDb + 1, Is.EqualTo(amountInDbAfterInsert)); }
private void addButton_Click(object sender, RoutedEventArgs e) { if (Utillity.CheckAddOrUpdateMonsterFields(nameTextBox, attackTextBox, hpTextBox)) { Monster m = new Monster { MonsterId = MonsterDB.GetNextMonsterId(), Alive = (bool)aliveCheckBox.IsChecked ? true : false, Attack = int.Parse(attackTextBox.Text), HP = int.Parse(hpTextBox.Text), Name = nameTextBox.Text }; MonsterDB.InsertMonster(m); monsterCollection.Add(m); MessageBox.Show("Monster Toegevoegd!"); } else { MessageBox.Show("Gelieve alle velden in te vullen"); } }