public PersonModel(string name, PetClassification petclass, PetType pettype, PetSize petsize) { Name = name; PreferredClassification = petclass; PreferredPetType = pettype; PetSize = petsize; }
/** * @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); }
private bool Tranquility; //Животное легко переносит перелёты? public Pet() { Random rnd = new Random(DateTime.Now.Millisecond); Size = (PetSize)rnd.Next(0, 2); Tranquility = Passenger.Coin(); }
public PetModel(string name, double weight, PetClassification petclass, PetType pettype, PetSize petsize) { Name = name; Weight = weight; Classification = petclass; Type = pettype; Size = petsize; }
/////////////////////// Add Pet Sizes //////////////////////////////////// public void AddPetSize(string size) { var petSize = new PetSize { PetSize1 = size }; _db.Add(petSize); SaveChanges(); }
//Admin/Position/Update public ActionResult Update(int id) { PetSize size = db.PetSizes.Find(id); if (size == null) { return(HttpNotFound()); } return(View(size)); }
public ActionResult Update(PetSize size) { if (ModelState.IsValid) { db.Entry(size).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(size)); }
public ActionResult Create(PetSize petSize) { if (ModelState.IsValid) { db.PetSizes.Add(petSize); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(petSize)); }
//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")); }
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()); }
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; }
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()); }
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; }
public void DeletePetsize(PetSize size) { _db.Remove(size); SaveChanges(); }
/////////////////////// Edit Pet Sizes //////////////////////////////////// public void EditPetsize(PetSize size) { //updates the current pet _db.Update(size); SaveChanges(); }
public rangerPet(PetType type, PetSize size) { petType = type; petSize = size; }