public PersonModel(string name, PetClassification petclass, PetType pettype, PetSize petsize)
 {
     Name = name;
     PreferredClassification = petclass;
     PreferredPetType        = pettype;
     PetSize = petsize;
 }
Esempio n. 2
0
        /**
         * @param WeightCheck -- The weight of the pet in question
         * @param PetSize -- The general description of size range (weight) a person wants
         *
         * @return bool -- Is the weight within the range specified in the BRD??
         */
        public static bool StepOnScale(double WeightCheck, PetSize DesiredSize)
        {
            // REQUIREMENT 2: WEIGHT JUDGEMENT
            bool res = false;

            switch (DesiredSize)
            {
            case PetSize.ExtraLarge:
                res = WeightCheck > 30.0 ? true : false;
                break;

            case PetSize.Large:
                res = WeightCheck > 15.0 && WeightCheck <= 30.0 ? true : false;
                break;

            case PetSize.Medium:
                res = WeightCheck > 5.0 && WeightCheck <= 15.0 ? true : false;
                break;

            case PetSize.Small:
                res = WeightCheck > 1.0 && WeightCheck <= 5.0 ? true : false;
                break;

            case PetSize.ExtraSmall:
                res = WeightCheck > 0 && WeightCheck <= 1.0 ? true : false;
                break;

            default:
                break;
            }

            return(res);
        }
Esempio n. 3
0
        private bool Tranquility; //Животное легко переносит перелёты?


        public Pet()
        {
            Random rnd = new Random(DateTime.Now.Millisecond);

            Size        = (PetSize)rnd.Next(0, 2);
            Tranquility = Passenger.Coin();
        }
Esempio n. 4
0
 public PetModel(string name, double weight, PetClassification petclass, PetType pettype, PetSize petsize)
 {
     Name           = name;
     Weight         = weight;
     Classification = petclass;
     Type           = pettype;
     Size           = petsize;
 }
Esempio n. 5
0
        /////////////////////// Add Pet Sizes ////////////////////////////////////
        public void AddPetSize(string size)
        {
            var petSize = new PetSize
            {
                PetSize1 = size
            };

            _db.Add(petSize);
            SaveChanges();
        }
Esempio n. 6
0
        //Admin/Position/Update
        public ActionResult Update(int id)
        {
            PetSize size = db.PetSizes.Find(id);

            if (size == null)
            {
                return(HttpNotFound());
            }
            return(View(size));
        }
Esempio n. 7
0
        public ActionResult Update(PetSize size)
        {
            if (ModelState.IsValid)
            {
                db.Entry(size).State = EntityState.Modified;

                db.SaveChanges();
                return(RedirectToAction("Index"));
            }
            return(View(size));
        }
Esempio n. 8
0
        public ActionResult Create(PetSize petSize)
        {
            if (ModelState.IsValid)
            {
                db.PetSizes.Add(petSize);
                db.SaveChanges();

                return(RedirectToAction("Index"));
            }
            return(View(petSize));
        }
Esempio n. 9
0
        //Admin/Position/Delete
        public ActionResult Delete(int id)
        {
            PetSize size = db.PetSizes.Find(id);

            if (size == null)
            {
                return(HttpNotFound());
            }
            db.PetSizes.Remove(size);
            db.SaveChanges();

            return(RedirectToAction("Index"));
        }
Esempio n. 10
0
        public void Negative_PetWeight_Should_Return_ExtraSmall_Size()
        {
            //arrange
            Pet pet = new Pet("Test", weight: -10, classification: PetClassification.Bird, type: PetType.Canary);

            //Act
            PetSize statusResult = pet.Size();

            //Assert
            PetSize expectedResult = PetSize.ExtraSmall;

            Assert.Equal(expectedResult.ToString(), statusResult.ToString());
        }
Esempio n. 11
0
 public Person(
     string name,
     PetType preferredType = PetType.None,
     PetType opposedType   = PetType.None,
     PetClassification preferredClassification = PetClassification.None,
     PetClassification opposedClassification   = PetClassification.None,
     PetSize preferredSize = PetSize.None,
     PetSize opposedSize   = PetSize.None
     )
 {
     Name                    = name;
     PreferredType           = preferredType;
     OpposedType             = opposedType;
     PreferredClassification = preferredClassification;
     OpposedClassification   = opposedClassification;
     PreferredSize           = preferredSize;
     OpposedSize             = opposedSize;
 }
Esempio n. 12
0
        public void Same_Preffered_Size_Opposed_Should_Set_Opposed_To_None()
        {
            //arrange
            List <Person> persons = new List <Person>()
            {
                new Person("Dogs", preferredSize: PetSize.Small, opposedSize: PetSize.Small)
            };

            Utils.SetSameOppossedToNone(persons);

            //Act
            PetSize statusResult = persons[0].OpposedSize;

            //Assert
            PetSize expectedResult = PetSize.None;

            Assert.Equal(expectedResult.ToString(), statusResult.ToString());
        }
Esempio n. 13
0
        public void Opposed_Size_Should_Return_Same_Opposed_Size()
        {
            //arrange
            PetSize expectedResult = PetSize.Small;

            List <Person> persons = new List <Person>()
            {
                new Person("Dogs", opposedSize: expectedResult)
            };

            Utils.SetSameOppossedToNone(persons);

            //Act
            PetSize statusResult = persons[0].OpposedSize;

            //Assert
            Assert.Equal(expectedResult.ToString(), statusResult.ToString());
        }
 void iThinkThisIsGross.NotLikeThis(Enum NoBueno)
 {
     this.PetSize = (PetSize)NoBueno;
 }
Esempio n. 15
0
 public void DeletePetsize(PetSize size)
 {
     _db.Remove(size);
     SaveChanges();
 }
Esempio n. 16
0
 /////////////////////// Edit Pet Sizes ////////////////////////////////////
 public void EditPetsize(PetSize size)
 {
     //updates the current pet
     _db.Update(size);
     SaveChanges();
 }
Esempio n. 17
0
 public rangerPet(PetType type, PetSize size)
 {
     petType = type;
     petSize = size;
 }