public static void Main() { Chef chef = new Chef(); Potato potato = new Potato(); potato.IsRotten = false; if (potato != null) { // Potato will be peeled during Cook process, so this check is not necessary if (!potato.IsRotten) { chef.Cook(potato); Console.WriteLine("Potato is cooked!"); } else { throw new ArgumentOutOfRangeException("Cannot cook rotten potato!"); } } else { throw new ArgumentNullException("There is no potato!"); } }
public static void Main() { // Task 1 from homework. Potato potato = new Potato(); if (potato != null) { if (potato.HasBeenPeeled && !potato.IsRotten) { Chef chefForTestCook = new Chef(); // I change Cook(potato) to chefForTestCook.Cook(); // because method Cook doen not accept arguments. chefForTestCook.Cook(); } } // Task 2 from homework. int x = 5; int y = 10; // Names aren't perfect, but I don't know what condition they check. bool isXConditionTrue = x >= MinX; bool isOtherConditionTrue = (x <= MaxX) && (MaxY >= y && MinY <= y); if (isXConditionTrue && isOtherConditionTrue && isVisitCell) { VisitCell(); } }
public static void Main() { Potato potato = new Potato(); if (potato != null && potato.HasBeenPeeled && potato.IsHealthy) { Cook(potato); } int x = 0; int minimumX = 0; int maximumX = 0; int y = 0; int minimumY = 0; int maximumY = 0; bool shouldVisitCell = true; bool isValidX = minimumX <= x && x <= maximumX; bool isValidY = minimumY <= y && y <= maximumY; bool isValidCell = shouldVisitCell; if (isValidCell && isValidX && isValidY) { VisitCell(); } }
public static void Main() { Potato potato = new Potato(); Chef chef = new Chef(); potato.IsPeeled = true; potato.IsRotten = false; if (potato != null) { if (potato.isPeeled && !potato.IsRotten) { chef.Cook(potato); } } else { Console.WriteLine("Probably potato is not the best choice for dish today. :) "); } int x = 7; int y = 21; bool shouldVisitCell = true; if (IsInRange(y, MaxY, MinY) && IsInRange(x, MinX, MaxX) && shouldVisitCell) { VisitCell(); } else { Console.WriteLine("Cell cannot be visited"); } }
public void Cook() { Bowl bowl = GetBowl(); Potato potato = GetPotato(); Peel(potato); Cut(potato); bowl.Add(potato); Carrot carrot = GetCarrot(); Peel(carrot); Cut(carrot); bowl.Add(carrot); //OR *depends on the specific case* Potato potato = GetPotato(); Peel(potato); Cut(potato); Carrot carrot = GetCarrot(); Peel(carrot); Cut(carrot); Bowl bowl = GetBowl(); bowl.Add(potato); bowl.Add(carrot); }
private Potato GetPotato() { Potato potato = new Potato(); Console.WriteLine("One more potato."); return potato; }
public void ProcessPotato(Potato potato) { if (potato != null && potato.IsPeeled && !potato.IsRotten) { chef.Cook(potato); } }
static void Main() { const int MIN_X = 0; const int MAX_X = 0; const int MIN_Y = 0; const int MAX_Y = 0; int x = 0; int y = 0; bool shouldVisitCell = true; bool isXInRange = MIN_X <= x && x <= MAX_X; bool isYInRange = MIN_Y <= y && y <= MAX_Y; if (isXInRange && isYInRange && shouldVisitCell) { VisitCell(); } // Reference to exercise 1 is added Potato potato = new Potato(); if (potato != null) { if (potato.IsPeeled && !potato.IsRotten) { Cook(potato); } } }
public static void Main() { // task 2 int x = 0; int y = 0; int minX = 0; int maxX = 0; int maxY = 0; int minY = 0; bool shoudVisitCell = true; bool isYBetweemMinMax = minY <= y && y <= maxY; bool isXBetweenMinMax = minX <= x && x <= maxX; if (isXBetweenMinMax && (isYBetweemMinMax && shoudVisitCell)) { VisitCell(); } // task 1 Potato potato = new Potato(); if (potato != null) { if (potato.IsPeeled && potato.IsRotten) { Cook(potato); } } }
/// <summary> /// The main. /// </summary> /// <param name="args"> /// The args. /// </param> private static void Main(string[] args) { // First part of the task var potato = new Potato(); if (potato != null) { if (!potato.HasNotBeenPeeled && !potato.IsRotten) { Cook(potato); } } // Second part of the task int x = 0, y = 0; const int MIN_X = 0; const int MIN_Y = 0; const int MAX_X = 0; const int MAX_Y = 0; var shouldVisitCell = true; if (shouldVisitCell && (MIN_X >= x && x <= MAX_X) && (MIN_Y >= y && y <= MAX_Y)) { VisitCell(); } }
public IActionResult Put(Potato potato) { _context.Potatoes.Update(potato); _context.SaveChanges(); return(Ok()); }
static void Main() { Potato potato = new Potato(); if (potato != null) { if (potato.HasBeenPeeled && !potato.IsRotten) { Chef chef = new Chef(); chef.Cook(potato); } } else { throw new NullReferenceException("Potato does not exist"); } /*---------------------------------------------------------------*/ const int MinX = 0; const int MaxX = 0; const int MinY = 0; const int MaxY = 0; int x = 0; int y = 0; bool shouldVisitCell = true; bool xIsInRange = x >= MinX && MaxX >= x; bool yIsInRange = y <= MaxY && MinY >= y; if (xIsInRange && yIsInRange && shouldVisitCell) { VisitCell(); } }
static void Main() { Potato potato = new Potato(); if (potato != null) { bool notPeeled = !potato.IsPeeled; bool notRotten = !potato.IsRotten; if (notPeeled && notRotten) { potato.Cook(); } } const int MinX = 5; const int MaxX = 15; const int MinY = 5; const int MaxY = 15; int x = 7; int y = 8; bool shouldVisitCell = true; if (shouldVisitCell && IsInRange(x, MinX, MaxX) && IsInRange(y, MinY, MaxY)) { VisitCell(); } }
static void Main(string[] args) { Potato potato = new Potato(); //... if (potato != null) { if (!potato.HasBeenPeeled && !potato.IsRotten) { Cook(potato); } } //Second sub-task of refactoring the if-statements bool shouldVisitCell = false; const int MIN_X = 10; const int MAX_X = 20; const int MIN_Y = 10; const int MAX_Y = 50; int x = 12; int y = 20; if ((x >= MIN_X && x <= MAX_X) && (y >= MIN_Y && y <= MAX_Y) && !shouldVisitCell) { VisitCell(); } }
static void Main(string[] args) { Potato potato = null; //... if (potato != null) { if (potato.HasBeenPeeled && !potato.IsRotten) { Cook(potato); } } //... int x = 0; int y = 0; bool shouldVisitCell = true; bool xIsInInterval = CheckInInterval(x, MIN_X, MAX_X); bool yIsInInterval = CheckInInterval(y, MIN_Y, MAX_Y); if (xIsInInterval && yIsInInterval && shouldVisitCell) { VisitCell(); } }
static void Main(string[] args) { //first task IVegetable potato = new Potato(); //... potato.IsPeeled = true; potato.IsGoodToEat = true; if (potato != null) { if (potato.IsPeeled && potato.IsGoodToEat) { Cook(potato); } } //second task int x = 0; int y = 0; int minX = 0; int maxX = 0; int maxY = 0; int minY = 0; bool shoudVisitCell = true; bool isYInRange = minY <= y && y <= maxY; bool isXInRange = minX <= x && x <= maxX; if (isXInRange && (isYInRange && shoudVisitCell)) { VisitCell(); } }
private Potato GetPotato() { Potato result = new Potato(); // ... return result; }
public static void Main(string[] args) { // First Task: Potato potato = new Potato(); // ... if (potato == null) { throw new ArgumentNullException(); } var me = new Chef("Ivan"); var ingredients = new List<Vegetable>(); ingredients.Add(potato); if (potato.IsPeeled && !potato.IsRotten) { me.CookVegitables(ingredients, new Bowl()); } // Second Task: const int MIN_X = -100; const int MAX_X = 100; const int MIN_Y = -50; const int MAX_Y = 50; int x = 0; int y = 0; bool shouldVisitCell = true; bool inRangeX = MIN_X <= x && x <= MAX_X; bool inRangeY = MIN_Y <= y && y <= MAX_Y; if (inRangeX && inRangeY && shouldVisitCell) { VisitCell(x, y); } }
static void Main(string[] args) { //first task IVegetable potato = new Potato(); //... potato.IsPeeled = true; potato.IsGoodToEat = true; if (potato != null) { if(potato.IsPeeled && potato.IsGoodToEat) { Cook(potato); } } //second task int x = 0; int y = 0; int minX = 0; int maxX = 0; int maxY = 0; int minY = 0; bool shoudVisitCell = true; bool isYInRange = minY <= y && y <= maxY; bool isXInRange = minX <= x && x <= maxX; if (isXInRange && (isYInRange && shoudVisitCell)) { VisitCell(); } }
public void Cook(Potato potato) { if (CheckIfPotatoIsReadyForCooking(potato)) { potato.IsCooked = true; } }
private Potato GetPotato() { Potato result = new Potato(); // ... return(result); }
public void RefactorIfStatements() { Potato potato = new Potato(); if (potato == null) { throw new NullReferenceException("Potato cannot be null!"); } if (!potato.HasBeenPeeled && !potato.IsRotten) { this.Cook(potato); } // ------------------------------ const int MIN_X = default(int); const int MAX_X = default(int); const int MIN_Y = default(int); const int MAX_Y = default(int); int x = default(int); int y = default(int); bool isXInRange = x >= MIN_X && x <= MAX_X; bool isYInRange = y >= MIN_Y && y <= MAX_Y; bool shouldVisitCell = default(bool); if (isXInRange && isYInRange && shouldVisitCell) { this.VisitCell(); } }
public static void Main() { Potato potato = new Potato(); // ... if (potato != null && potato.HasBeenPeeled && !potato.IsRotten) { Cook(potato); } int x = 0; int y = 0; const int MinX = -200; const int MaxX = 200; const int MinY = -200; const int MaxY = 200; bool shouldVisitCell = true; bool inRangeX = MinX <= x && x <= MaxX; bool inRangeY = MinY <= y && y <= MaxY; if (inRangeX && inRangeY && shouldVisitCell) { VisitCell(); } }
public static void Main() { ////Task 2.1 here -------->>>> Potato potato = new Potato(); var vegetables = new List <IVegetable> { potato }; Chef chef = new Chef(); if (vegetables.Count > 0) { foreach (var vegetable in vegetables) { if (vegetable.IsRotten) { throw new ArgumentException("There is a rotten vegetable! Can't Cook."); } chef.Cook(vegetables); } } //// Task 2.2 is here ---->>> ////if (x >= MIN_X && (x =< MAX_X && ((MAX_Y >= y && MIN_Y <= y) && !shouldNotVisitCell))) ////{ //// VisitCell(); ////} }
public void Chop(Mobile from) { if (from.InRange(this.GetWorldLocation(), 1)) { if (from == m_sower) { from.Direction = from.GetDirectionTo(this); double lumberValue = from.Skills[SkillName.Lumberjacking].Value / 100; if ((lumberValue > .5) && (Utility.RandomDouble() <= lumberValue)) { Potato fruit = new Potato(Utility.Random(m_yield + 2)); from.AddToBackpack(fruit); } this.Delete(); from.SendMessage("You chop the plant up"); } else { from.SendMessage("You do not own this plant !!!"); } } else { from.SendLocalizedMessage(500446); } }
public void SameObjectsTest() { Potato potato = new Potato(200, 45, "Greenhouse type"); Cabbage cabbage = new Cabbage(100, 24, "1 year"); Assert.AreNotSame(potato, cabbage); Console.WriteLine("Objects are not the same."); }
public IVegetable GetPotato() { var potato = new Potato(); this.speachLogger.Say("We got a potato, that's great!"); return(potato); }
public IVegetable GetPotato() { var potato = new Potato(); this.speachLog.Say("Potato Nom Nom!"); return(potato); }
public ActionResult DeleteConfirmed(int id) { Potato potato = db.Potatoes.Find(id); db.Potatoes.Remove(potato); db.SaveChanges(); return(RedirectToAction("Index")); }
public void Frank_Meana_RussetContainsCorrectImages() { // assign a Russet instance to the Potato potato = new Russet(); // test expected images match actual Assert.AreEqual(@"/Images/russet.png", potato.ImageSource(), "Russet image expected does not match actual"); Assert.AreEqual(@"/Images/russet_crossed.png", potato.CrossedImageSource(), "Russet crossed image expected does not match actual"); }
public void Frank_Meana_NadineContainsCorrectImages() { // assign a Nadine instance to the Potato potato = new Nadine(); // test expected images match actual Assert.AreEqual(@"/Images/nadine.png", potato.ImageSource(), "Nadine image expected does not match actual"); Assert.AreEqual(@"/Images/nadine_crossed.png", potato.CrossedImageSource(), "Nadine crossed image expected does not match actual"); }
public void Frank_Meana_MajestyContainsCorrectImages() { // assign a Majesty instance to the Potato potato = new Majesty(); // test expected images match actual Assert.AreEqual(@"/Images/majesty.png", potato.ImageSource(), "Majesty image expected does not match actual"); Assert.AreEqual(@"/Images/majesty_crossed.png", potato.CrossedImageSource(), "Majesty crossed image expected does not match actual"); }
internal Potato GetPotato() { var potato = new Potato(); Peel(potato); Cut(potato); return potato; }
public void CollectionContainsAnObjectTest() { Salad salad = new Salad(); Vegetable potato = new Potato(200, 45, "Greenhouse type"); salad.Add(potato); Assert.Contains(potato, salad.SaladCollection); Console.WriteLine("Collection contains Potato object."); }
public void Frank_Meana_YukonContainsCorrectImages() { // assign a Yukon instance to the Potato potato = new Yukon(); // test expected images match actual Assert.AreEqual(@"/Images/yukon.png", potato.ImageSource(), "Yukon image expected does not match actual"); Assert.AreEqual(@"/Images/yukon_crossed.png", potato.CrossedImageSource(), "Yukon crossed image expected does not match actual"); }
public async Task <IEnumerable <Potato> > GetPotato(Potato currentUser) { var sql = "Select * from PotatoUsers where UserName = '******' and Password = '******'"; using (var conn = DataConnectionProvider.GetProdConnection()) { return(await conn.QueryAsync <Potato>(sql)); } }
internal Potato GetPotato() { var potato = new Potato(); Peel(potato); Cut(potato); return(potato); }
public void Cook() { Bowl bowl; Potato potato = GetPotato(); Carrot carrot = GetCarrot(); bowl = GetBowl(); Peel(carrot); bowl.Add(carrot); }
static void Main() { var cooker = new Cooker(); var potato = new Potato(); cooker.CheckIfPotatoIsReadyForCooking(potato); var cellValidator = new CellValidator(); cellValidator.VisitedCell(); }
public static void Main(string[] args) { Potato potato = new Potato(5); if (potato != null) { if (potato.HasBeenPeeled && !potato.IsRotten) { Cook(potato); } } }
public static void Main() { Potato potato = new Potato(); if (potato != null) { if (potato.IsPeeled && !potato.IsRotten) { potato.Cook(); } } }
public static void Main() { Potato potato = new Potato(); if (potato != null) { bool cookCondition = potato.HasBeenPeeled && !potato.IsRotten; if (cookCondition) { Cook(potato); } } }
//task 2.1 public void RefactoringPotato() { Potato potato = new Potato(); //... if (potato != null) { // the two fields are made into the abstract class - Vegetable if (!(potato.HasNotBeenPeeled && potato.IsRotten)) { Cook(potato); } } }
public static void Main() { Potato potato = new Potato(); if (potato != null) { if (!(potato.HasNotBeenPeeled || potato.IsRotten)) { Chef masterChef = new Chef(); masterChef.Cook(potato); } } }
public static void Main() { Chef chef = new Chef(); Potato potato = new Potato(); if (potato == null) { throw new ArgumentNullException("Potato should be created."); } else if (potato.IsPeeled && potato.IsRotten) { chef.Cook(potato); } }
public static Night Create() { Night instance = new Night(); instance.Add(new Steak()); Potato obj = new Potato(); obj.EnableMultipleOrder(); instance.Add(obj); instance.Add(new Wine()); instance.Add(new Cake()); return instance; }
public void Main() { Potato potato = new Potato(); Carrot carrot = new Carrot(); Peel(potato); Peel(carrot); Cut(potato); Cut(carrot); Bowl bowl = new Bowl(); bowl.Add(carrot); bowl.Add(potato); }
private static void CookPotato() { Potato potato = new Potato(); Chef utiBachvarov = new Chef(); utiBachvarov.Peel(potato); if (potato != null) { if (!potato.IsRotten && potato.HasBeenPeeled) { Cook(potato); } } }
public void Cook(Vegetable vegetable) { Potato potato = new Potato(); potato.Peel(); potato.Cut(); Carrot carrot = new Carrot(); carrot.Peel(); carrot.Cut(); Bowl bowl = new Bowl(); bowl.Add(potato); bowl.Add(carrot); }
public static void CookPotato() { // doesn't compile if not instanced Potato potato = new Potato(); // ... if (potato != null) { if (potato.HasBeenPeeled && potato.IsFresh) { Cook(potato); } } }
public void Cook() { Potato potato = new Potato(); Carrot carrot = new Carrot(); Bowl bowl = new Bowl(); Potato.Peel(potato); Carrot.Peel(carrot); this.Cut(potato); this.Cut(carrot); bowl.AddVegetable(potato); bowl.AddVegetable(carrot); }
private static void PreparePotato() { Potato potato = new Potato(); // ... if (potato != null && potato.IsPeeled && potato.IsFresh) { // Cook(potato); } else { // TODO: throw three different exceptions for each case throw new ApplicationException("Cannot cook potato!"); } }
public static void RefactorPotatoStatements() { Potato potato = new Potato(); if (potato != null) { bool notPeeled = !potato.IsPeeled; bool notRotten = !potato.IsRotten; if (notPeeled && notRotten) { potato.Cook(); } } }
static void Main(string[] args) { Potato potato = new Potato(); if (potato != null) { if (!potato.IsRotten && potato.HasBeenPeeled) { Cook(potato); } } if (IsInRange(x, MIN_X, MAX_X) && IsInRange(y, MIN_Y, MAX_Y) && shouldVisitCell) { VisitCell(x, y); } }
static void Main() { const int MinX = 5; const int MaxX = 15; const int MinY = 5; const int MaxY = 15; Potato potato = new Potato(); //Task 2.1 /* Potato potato; //... if (potato != null) if(!potato.HasNotBeenPeeled && !potato.IsRotten) Cook(potato); */ if (potato != null) { bool notPeerled = !potato.IsPeeled; bool notRotten = !potato.IsRotten; if (notPeerled && notRotten) { potato.Cook(); } } int x = 7; int y = 8; bool shouldVisitCell = true; //Task 2.2 /* if (x >= MIN_X && (x =< MAX_X && ((MAX_Y >= y && MIN_Y <= y) && !shouldNotVisitCell))) { VisitCell(); } */ if (shouldVisitCell && IsInRange(x, MinX, MaxX) && IsInRange(y, MinY, MaxY)) { VisitCell(); } }
public void TaskTwoMethod(Potato potato) { if (potato == null) { throw new ArgumentException("The potato to cook is null"); } else if (!potato.IsPeeled) { throw new ArgumentException("The potato is not peeled!"); } else if (potato.IsRotten) { throw new ArgumentException("The potato is rotten!"); } this.Cook(potato); }