Ejemplo n.º 1
0
        public void TestAddOwnerWithExistedEmail()
        {
            Shelter theShelter = new Shelter("Fontys", "NL", 0123456, "*****@*****.**");
            Owner   o          = new Owner("le", "a");

            theShelter.AddOwner(o);
            Assert.AreEqual(theShelter.AddOwner(new Owner("An", "a")), false);
        }
Ejemplo n.º 2
0
        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);
        }
Ejemplo n.º 3
0
        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);
        }
Ejemplo n.º 4
0
        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);
        }
Ejemplo n.º 5
0
        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);
        }
Ejemplo n.º 6
0
        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);
        }
Ejemplo n.º 7
0
        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);
        }
Ejemplo n.º 8
0
        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);
        }
Ejemplo n.º 9
0
        private void btnRegister_Click(object sender, EventArgs e)
        {
            string lastname = tbLastName_pnOwnerRegister.Text;
            string email    = tbEmail_pnOwnerRegister.Text;

            if (lastname == "" || email == "")
            {
                lbNotification.Text = "Please input enough information!";
            }
            else
            {
                if (myShelter.AddOwner(new Owner(lastname, email)))
                {
                    lbNotification.Text = "Owner Added!";
                }
                else
                {
                    lbNotification.Text = "This owner is already existed";
                }
            }
        }