public static Soket CreateSoket() { Telephone telephone = new Telephone(); telephone.Name = "Sony ericson"; telephone.SetDigit(16); telephone.setTransducerResistance(50); Computer computer = new Computer(); computer.Name = "HP1577"; computer.SetDigit(32); computer.setVideoFrequency(1.7); Microwave microwave = new Microwave(); microwave.Name = "Samsung c 1677"; microwave.setTemperatureCoefficient(1.8); microwave.setMagnetronEfficiency(47); Refrigerator refrigerator = new Refrigerator(); refrigerator.Name = "Birysa17"; refrigerator.setTemperatureCoefficient(1.8); refrigerator.SetAnchorResistance(90); Soket soket = new Soket(); soket.AddAppliance(telephone); soket.AddAppliance(computer); soket.AddAppliance(refrigerator); soket.AddAppliance(microwave); return(soket); }
public void Invalid_items_should_throw() { var item = new Refrigerator(); var priceTable = new PriceTable <ICarItem>(); Assert.ThrowsException <InvalidOperationException>(() => priceTable.AddItem(item.GetType(), 10)); }
public void RefrigeratorTestTwo() { Refrigerator refrigerator = new Refrigerator(); Tomato tomato = new Tomato(); Cabbage cabbage = new Cabbage(); LadyFinger ladyFinger = new LadyFinger(); refrigerator.AddVegetable(tomato, 25); refrigerator.SetVegetableMinimumQuantity(tomato, 10); refrigerator.AddVegetable(cabbage, 10); refrigerator.SetVegetableMinimumQuantity(cabbage, 2); refrigerator.AddVegetable(ladyFinger, 7); refrigerator.SetVegetableMinimumQuantity(ladyFinger, 2); refrigerator.TakeOutVegetable(tomato, 20); refrigerator.TakeOutVegetable(cabbage, 7); var actualVegetableQuantity = refrigerator.CheckRefrigeratorContents(); var expectedVegetableQuantity = new List <KeyValuePair <Vegetable, int> >(); expectedVegetableQuantity.Add(new KeyValuePair <Vegetable, int>(tomato, 5)); expectedVegetableQuantity.Add(new KeyValuePair <Vegetable, int>(cabbage, 3)); expectedVegetableQuantity.Add(new KeyValuePair <Vegetable, int>(ladyFinger, 7)); Assert.Equal(expectedVegetableQuantity, actualVegetableQuantity); }
public ActionResult DeleteConfirmed(int id) { Refrigerator refrigerator = db.Refrigerators.Find(id); db.Refrigerators.Remove(refrigerator); db.SaveChanges(); return(RedirectToAction("Index")); }
public void ListOfExistingVegetablesToSetMinimumQuantityTest() { refrigerator = new Refrigerator(); refrigerator.vegetableManager.AddVegetables("Tomato", 2); refrigerator.vegetableManager.AddVegetables("Cauliflower", 0); System.Collections.Generic.IEnumerable <VegetableQuantity> listOfVegetablesToSetMinimumQuantity = this.refrigerator.vegetableManager.ListOfExistingVegetablesToSetMinimumQuantity(); Assert.AreEqual(1, listOfVegetablesToSetMinimumQuantity.Count()); }
public void TwoInstancesWithReflection() { var appliance = new Refrigerator(); var result = appliance.ListAllKindsWithReflection(); Assert.AreEqual(2, result.Count()); CollectionAssert.AllItemsAreInstancesOfType(result, typeof(Appliance)); }
public Dialog(List <string> trackableKeywords) { mFridge = new Refrigerator(); var jsonDialog = File.ReadAllText("dialog.json"); mDialogNodes = JsonConvert.DeserializeObject <DialogStructure>(jsonDialog); mShoppingList = new ShoppingList(trackableKeywords); mDialogActions = new DialogActions(mShoppingList); mHandledNodes = new List <int>(); }
public PartialViewResult Add(string catchhall) { var catchs = catchhall.Split('/'); Device newDevice; if (!String.IsNullOrEmpty(catchs[0])) { using (DeviceContext db = new DeviceContext()) { switch (catchs[0]) { case "light": newDevice = new Light("Лампа", new Modeslvl(new string[] { "низкий", "средний", "высокий", "макс." })); db.Devices.Add(newDevice); db.SaveChanges(); return(PartialView("PartLight", newDevice)); case "tv": newDevice = new TV("TV", new Modeslvl(new string[] { "низкий", "средний", "высокий", "макс." }), new Volume100(), new Channel100()); db.Devices.Add(newDevice); db.SaveChanges(); return(PartialView("PartTV", newDevice)); case "cond": newDevice = new Conditioner("Cond", new Termostat()); db.Devices.Add(newDevice); db.SaveChanges(); return(PartialView("PartCond", newDevice)); case "ref": newDevice = new Refrigerator("Ref", new Modeslvl(new string[] { "эконом.", "авто", "интенс." }), new RefTemp(), new RefrigeratorSpace(50)); db.Devices.Add(newDevice); db.SaveChanges(); return(PartialView("PartRef", newDevice)); case "ref_add": return(PartialView("PartRefItem", new int[] { Convert.ToInt32(catchs[1]), Convert.ToInt32(catchs[2]) })); case "micr": newDevice = new Microwave("Micr", new Modeslvl((new string[] { "разморозка", "низкий", "средний", "макс" })), new NetTimer()); db.Devices.Add(newDevice); db.SaveChanges(); return(PartialView("PartMicrowave", newDevice)); default: throw new Exception("Bad Request"); } } } else { throw new Exception("Bad Request"); } }
public void TestToCheckTheQuantityOfTomatoes() { Refrigerator refrigerator = new Refrigerator(); Tomato tomato = new Tomato(); Cabbage cabbage = new Cabbage(); refrigerator.AddVegetable(tomato, 10); refrigerator.AddVegetable(cabbage, 10); Assert.Equal(10, refrigerator.GetVegetableQuantity(tomato)); }
public ActionResult Edit([Bind(Include = "ID,Quantity,FoodItemID")] Refrigerator refrigerator) { if (ModelState.IsValid) { db.Entry(refrigerator).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.FoodItemID = new SelectList(db.FoodItems, "ID", "Name", refrigerator.FoodItemID); return(View(refrigerator)); }
public void TestInsufficiencyNotification() { Refrigerator refrigerator = new Refrigerator(); Tomato tomato = new Tomato(); refrigerator.AddVegetable(tomato, 20); refrigerator.SetMinimumQuantity(tomato, 8); refrigerator.TakeOutVegetable(tomato, 15); Assert.Equal("Sent notification to refrigerator", refrigerator.SendNotification()); }
static void Postfix(Refrigerator __instance) { if (!Main.enabled) { return; } var building = __instance.GetComponent <Building>(); Main.SetCapacity(building, true); }
public void EmailNotificationTest() { var refrigerator = new Refrigerator(); var email = refrigerator.SetNotificationChannel("email"); email.SetMessageForInsufficiency("Vegetable insufficient..."); var expected = "Vegetable insufficient..."; var actual = email.GetMessageForInsufficiency(); Assert.Equal(expected, actual); }
public void TestWhenQuantityIsSufficient() { Refrigerator refrigerator = new Refrigerator(); Tomato tomato = new Tomato(); Cabbage cabbage = new Cabbage(); refrigerator.AddVegetable(tomato, 10); refrigerator.AddVegetable(cabbage, 8); string message = refrigerator.TakeOutVegetable(tomato, 2); Assert.Equal(8, refrigerator.GetVegetableQuantity(tomato)); }
public Refrigerator_Backpack(float xpos, float ypos, Refrigerator refrigerator) : base(xpos, ypos) { this.ReadyToRun(tex_Equipment_Refrigerator); _isArmor = false; enablePhysics = false; this.refrigerator = refrigerator; _equippedDepth = -12; scale = new(0.8f); _wearOffset = new Vec2(-7, -1); // todo // adujust wearOffset }
public void ConfigureMinimumQuantityTest() { refrigerator = new Refrigerator(); refrigerator.vegetableManager.AddVegetables("Tomato", 2); refrigerator.vegetableManager.AddVegetables("Cabbage", 2); refrigerator.vegetableManager.AddVegetables("Potato", 0); refrigerator.vegetableManager.AddVegetables("Tofu", 0); int numberOfVegetablesConfigured = this.refrigerator.configurationManager.ConfigureMinimumQuantity(); Assert.AreEqual(2, numberOfVegetablesConfigured); }
private void OnCopySettings(object data) { GameObject gameObject = (GameObject)data; if (!((Object)gameObject == (Object)null)) { Refrigerator component = gameObject.GetComponent <Refrigerator>(); if (!((Object)component == (Object)null)) { UserMaxCapacity = component.UserMaxCapacity; } } }
public void TestWhenQuantityReachesMinimumLimitAndOrderAutomaticallyPlaced() { Refrigerator refrigerator = new Refrigerator(); Tomato tomato = new Tomato(); Cabbage cabbage = new Cabbage(); refrigerator.AddVegetable(tomato, 10); refrigerator.AddVegetable(cabbage, 8); string message = refrigerator.TakeOutVegetable(tomato, 10); Assert.Equal(5, refrigerator.GetVegetableQuantity(tomato)); }
/// <summary> /// Test of the GetAllProductsTest function. /// </summary> static public void GetAllProductsTest() { StoreBL storeBL = new StoreBL(); Store store = new Store(); PenDrive pen1 = new PenDrive(); pen1.Memory = 500; pen1.Model = "Kingston"; pen1.Price = 20; PenDrive pen2 = new PenDrive(); pen2.Memory = 300; pen2.Model = "HP"; pen2.Price = 17; Phone pho1 = new Phone(); pho1.Inches = 30; pho1.Model = "HP"; pho1.Price = 17; Phone pho2 = new Phone(); pho2.Inches = 30; pho2.Model = "HP"; pho2.Price = 17; Refrigerator ref1 = new Refrigerator(); ref1.Brand = "Samsung"; ref1.Capacity = 50; ref1.Price = 430; Refrigerator ref2 = new Refrigerator(); ref2.Brand = "Fujitsu"; ref2.Capacity = 100; ref2.Price = 600; store.Products.Pendrives.Add(pen1); store.Products.Pendrives.Add(pen2); store.Products.Phones.Add(pho1); store.Products.Phones.Add(pho1); store.Products.Refrigerators.Add(ref1); store.Products.Refrigerators.Add(ref2); Console.WriteLine(storeBL.GetAllProducts(store)); }
public void DoSomething() { var bulb = new Bulb(); var refrigerator = new Refrigerator(); var equipmentSwitch = new Switch(); equipmentSwitch.SetEquipment(bulb); equipmentSwitch.On(); equipmentSwitch.Off(); equipmentSwitch.SetEquipment(refrigerator); equipmentSwitch.On(); equipmentSwitch.Off(); }
// GET: Refrigerators/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Refrigerator refrigerator = db.Refrigerators.Find(id); if (refrigerator == null) { return(HttpNotFound()); } return(View(refrigerator)); }
public void TestWhenQuantityReachesMinimumLimitAndOrderPlacedNotifyUser() { Refrigerator refrigerator = new Refrigerator(); NotificationFactory notificationFactory = new NotificationFactory(); INotificationManager notificationManager = notificationFactory.GetNotificationType("email"); Tomato tomato = new Tomato(); Cabbage cabbage = new Cabbage(); refrigerator.AddVegetable(tomato, 10); refrigerator.AddVegetable(cabbage, 8); Assert.Equal(notificationManager.NotifyMinimumValueReached() + "." + notificationManager.NotifyOrderPlacedStatus(), refrigerator.TakeOutVegetable(tomato, 10)); }
public void TestWhenQuantityIsSufficientNotifyUser() { Refrigerator refrigerator = new Refrigerator(); NotificationFactory notificationFactory = new NotificationFactory(); INotificationManager notificationManager = notificationFactory.GetNotificationType("email"); Tomato tomato = new Tomato(); Cabbage cabbage = new Cabbage(); refrigerator.AddVegetable(tomato, 10); refrigerator.AddVegetable(cabbage, 8); Assert.Equal(notificationManager.NotifySufficientQuantity(), refrigerator.TakeOutVegetable(tomato, 8)); }
// GET: Refrigerators/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Refrigerator refrigerator = db.Refrigerators.Find(id); if (refrigerator == null) { return(HttpNotFound()); } ViewBag.FoodItemID = new SelectList(db.FoodItems, "ID", "Name", refrigerator.FoodItemID); return(View(refrigerator)); }
public void AddVegetableToEmptyTrayTest() { var refrigerator = new Refrigerator(); var tomato = new Tomato(); refrigerator.AddVegetable(tomato, 4); var expected = new List <KeyValuePair <Vegetable, int> >() { new KeyValuePair <Vegetable, int>(tomato, 4) }; var actual = refrigerator.GetVegetableQuantity(); Assert.Equal(expected, actual); }
public void TrackQuantityTest() { var refrigerator = new Refrigerator(); var tomato = new Tomato(); refrigerator.AddVegetable(tomato, 5); refrigerator.SetMinimumVegetableQuantity(tomato, 7); var expected = new List <KeyValuePair <Vegetable, int> >() { new KeyValuePair <Vegetable, int>(tomato, 5) }; var actual = refrigerator.TrackQuantity(); Assert.Equal(expected, actual); }
public void TestInsufficientVegetableQuantity() { Refrigerator refrigerator = new Refrigerator(); Tomato tomato = new Tomato(); refrigerator.AddVegetable(tomato, 20); refrigerator.SetMinimumQuantity(tomato, 8); refrigerator.TakeOutVegetable(tomato, 15); var expectedInsufficientVegetableQuantity = new List <KeyValuePair <Vegetable, int> >(); expectedInsufficientVegetableQuantity.Add(new KeyValuePair <Vegetable, int>(tomato, 3)); var actualInsufficientVegetableQuantity = refrigerator.GetAllInsufficientVegetables(); Assert.Equal(expectedInsufficientVegetableQuantity.OrderBy(x => x.Key.Name), actualInsufficientVegetableQuantity.OrderBy(x => x.Key.Name)); }
public void TakeOutVegetableFromTrayTest() { var refrigerator = new Refrigerator(); var tomato = new Tomato(); refrigerator.AddVegetable(tomato, 5); //refrigerator.SetMinimumVegetableQuantity(new Tomato(), 2); refrigerator.TakeOutVegetable(tomato, 3); var expected = new List <KeyValuePair <Vegetable, int> >() { new KeyValuePair <Vegetable, int>(tomato, 2) }; var actual = refrigerator.GetVegetableQuantity(); Assert.Equal(expected, actual); }
private void Load(object sender, RoutedEventArgs e) { //иннициализация холодильника и его событий rfEvents = new TeamsJournal(); Freezer firstCam = new Freezer(new TemperatureControl(RegimeOfFreeze.min, "First Freezer")); Freezer secondCam = new Freezer(new TemperatureControl(RegimeOfFreeze.min, "SecondFreezer")); Freezer thirdCam = new Freezer(new TemperatureControl(RegimeOfFreeze.min, "ThirdFreezer")); TemperatureEvent(firstCam, firstFreezeCelsius); TemperatureEvent(secondCam, secondFreezeCelsius); TemperatureEvent(thirdCam, thirdFreezeCelsius); MessageEvent(firstCam, rfEvents); MessageEvent(secondCam, rfEvents); MessageEvent(thirdCam, rfEvents); Rf = new Refrigerator(firstCam, secondCam, thirdCam); Rf.ON(); }
public void TestVegetableQuantity() { Refrigerator refrigerator = new Refrigerator(); Cabbage cabbage = new Cabbage(); Tomato tomato = new Tomato(); refrigerator.AddVegetable(cabbage, 10); refrigerator.AddVegetable(tomato, 20); var expectedVegetableQuantity = new List <KeyValuePair <Vegetable, int> >(); expectedVegetableQuantity.Add(new KeyValuePair <Vegetable, int>(cabbage, 10)); expectedVegetableQuantity.Add(new KeyValuePair <Vegetable, int>(tomato, 20)); var actualVegetableQuantity = refrigerator.GetVegetableQuantity(); Assert.Equal(expectedVegetableQuantity.OrderBy(x => x.Key.Name).ToList(), actualVegetableQuantity.OrderBy(x => x.Key.Name).ToList()); }