public void TestAddAnimalWithExistedRFID() { Shelter theShelter = new Shelter("Fontys", "NL", 0123456, "*****@*****.**"); Cat a = new Cat("ha2910", "pretty", "Fontys", "4 years", DateTime.Now); theShelter.AddAnimal(a); Assert.AreEqual(theShelter.AddAnimal(new Dog("ha2910", "beautiful", "Fontys", DateTime.Now)), false); }
public void TestClaimingBefore20DaysWithNewOwner() { Shelter theShelter = new Shelter("Fontys", "NL", 0123456, "*****@*****.**"); Cat a = new Cat("ha2910", "pretty", "Fontys", "4 years", DateTime.Now); Owner o = new Owner("le", "a"); decimal fee = 0; theShelter.AddAnimal(a); theShelter.AddOwner(o); Assert.AreEqual(a.Claim(o, ref fee), false); }
private void RFIDinput_Tag(object sender, RFIDTagEventArgs e) { if (e.Tag != "") { if (myShelter.GetAnimal(e.Tag) != null) { lbNotification.Text = "This RFID tag was already used!"; } else { string description = tbxDescription_Add.Text; string foundLocation = tbxFoundLocation_Add.Text; DateTime broughtInDate = DateTimePicker_AddingForm.Value; bool added = false; if (rbtnCat.Checked) { string extraInfo = tbxExtraInfo_Add.Text; if (myShelter.AddAnimal(new Cat(e.Tag, description, foundLocation, extraInfo, broughtInDate))) { added = true; } } if (rbtnDog.Checked) { if (myShelter.AddAnimal(new Dog(e.Tag, description, foundLocation, broughtInDate))) { added = true; } } if (added) { lbNotification.Text = "Added successfully!"; } else { lbNotification.Text = "Added unsuccessfully!"; } RFIDaddingAnimal.Close(); } } }
public void TestAdoptionAfter20daysWithNewOwner() { Shelter theShelter = new Shelter("Fontys", "NL", 0123456, "*****@*****.**"); DateTime value = new DateTime(2018, 1, 18); Cat a = new Cat("ha2910", "pretty", "Fontys", "4 years", value); Owner o = new Owner("le", "a"); decimal fee = 0; theShelter.AddAnimal(a); theShelter.AddOwner(o); Assert.AreEqual(a.Adopt(o, ref fee), true); }
public void TestCalculateFeeForAdoption() { Shelter theShelter = new Shelter("Fontys", "NL", 0123456, "*****@*****.**"); DateTime value = new DateTime(2018, 9, 8); Cat a = new Cat("ha2910", "pretty", "Fontys", "4 years", value); Owner o = new Owner("le", "a"); theShelter.AddAnimal(a); theShelter.AddOwner(o); Assert.AreEqual(a.CalculateFee(o.ID), 25); }
public void TestClaimingBefore20DaysWithPreviousOwner() { Shelter theShelter = new Shelter("Fontys", "NL", 0123456, "*****@*****.**"); DateTime value = new DateTime(2018, 10, 8); Cat a = new Cat("ha2910", "pretty", "Fontys", "4 years", value); Owner o = new Owner("le", "a"); decimal fee = 0; theShelter.AddAnimal(a); theShelter.AddOwner(o); a.UpdateOwner(o); Assert.AreEqual(a.Claim(o, ref fee), true); }
public void TestAdoptionAfter20daysWithPreviousOwner() { Shelter theShelter = new Shelter("Fontys", "NL", 0123456, "*****@*****.**"); Cat a = new Cat("ha2910", "pretty", "Fontys", "4 years", DateTime.Now); Owner o = new Owner("le", "a"); a.UpdateOwner(o); decimal fee = 0; theShelter.AddAnimal(a); theShelter.AddOwner(o); Assert.AreEqual(a.Adopt(o, ref fee), false); }
public void TestCalculateFeeForClaiming() { Shelter theShelter = new Shelter("Fontys", "NL", 0123456, "*****@*****.**"); DateTime value = new DateTime(2018, 10, 9); Dog d = new Dog("ha2910", "pretty", "Fontys", value); Owner o = new Owner("le", "a"); theShelter.AddAnimal(d); theShelter.AddOwner(o); d.UpdateOwner(o); Assert.AreEqual(d.CalculateFee(o.ID), 12); }
private void btnAddAnimal_Click(object sender, EventArgs e) { try { DateTime entryDate = dateTimePickerEntryDate.Value; string locationFound = tbLocataion.Text; string pedegree = tbPedigree.Text; if (radioCat.Checked) { string habit = tbHabit.Text; Cat cat = new Cat(animalShelter.CreateChipNr(), entryDate, pedegree, locationFound, habit); if (animalShelter.AddAnimal(cat)) { MessageBox.Show("Your cat is added"); } else { MessageBox.Show("Fail to add this cat"); } } else { Dog dog = new Dog(animalShelter.CreateChipNr(), entryDate, pedegree, locationFound, entryDate); if (animalShelter.AddAnimal(dog)) { MessageBox.Show("Your dog is added"); } else { MessageBox.Show("Fail to add this dog"); } } } catch { MessageBox.Show("Invalid input"); } }
public void TestClaimingAfterAdoptionfromNewOwner() { Shelter theShelter = new Shelter("Fontys", "NL", 0123456, "*****@*****.**"); DateTime value = new DateTime(2018, 9, 8); Cat a = new Cat("ha2910", "pretty", "Fontys", "4 years", value); Owner o = new Owner("le", "a"); decimal fee = 0; theShelter.AddAnimal(a); theShelter.AddOwner(o); a.UpdateOwner(o); a.Adopt(new Owner("N", "b"), ref fee); Assert.AreEqual(a.Claim(o, ref fee), false); }