public void addTechnic(Technics item) { Technics[] buff = new Technics[_technics.Length + 1]; Array.Copy(_technics, buff, _technics.Length); buff[_technics.Length] = item; _technics = buff; }
public void Plus_TechnicsAndTechnics_Equal() { // arrange string name1 = "smartphone"; decimal price1 = 320.9m; string type1 = "Technics"; Technics technics1 = new Technics(name1, type1, price1); string name2 = "computer"; decimal price2 = 540m; string type2 = "Technics"; Technics technics2 = new Technics(name2, type2, price2); string name3 = "smartphone-computer"; decimal price3 = 430.45m; string type3 = "Technics"; Technics technics3Expected = new Technics(name3, type3, price3); // act Technics actual = technics1 + technics2; // assert; Assert.Equal(technics3Expected, actual); }
public void Test_ConvertToTechnics() { var furniture = new Furniture("furniture", "cupboard", 120.99m); var result = (Technics)furniture; var actualResult = new Technics("furniture", "cupboard", 120.99m); Assert.AreEqual(result, actualResult); }
public void Test_ConvertToDecimal() { var technics = new Technics("technics", "computer1", 2099.99m); var result = (decimal)technics; decimal actualResult = 2099.99m; Assert.AreEqual(result, actualResult); }
public void Test_ConvertToInt32() { var technics = new Technics("technics", "computer1", 2099.99m); var result = (int)technics; int actualResult = 209999; Assert.AreEqual(result, actualResult); }
public void Test_ConvertToFurniture() { var technics = new Technics("technics", "computer1", 2099.99m); var result = (Furniture)technics; var actualResult = new Furniture("technics", "computer1", 2099.99m); Assert.AreEqual(result, actualResult); }
public void Test_ConvertToTechnics() { var food = new Food("food", "milk", 13.99m); var result = (Technics)food; var actualResult = new Technics("food", "milk", 13.99m); Assert.AreEqual(result, actualResult); }
public ActionResult DeleteConfirmed(int id) { Technics technics = db.Technics.Find(id); db.Technics.Remove(technics); db.SaveChanges(); return(RedirectToAction("Index")); }
public void Test_OperatorPlus() { var technics1 = new Technics("technics", "computer1", 2099.99m); var technics2 = new Technics("technics", "computer2", 3099.99m); Technics result = technics1 + technics2; var actualResult = new Technics("technics", "computer1-computer2", 2599.99m); Assert.AreEqual(result, actualResult); }
public ActionResult Edit([Bind(Include = "Id,Name")] Technics technics) { if (ModelState.IsValid) { db.Entry(technics).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(technics)); }
public ActionResult Create([Bind(Include = "Id,Name")] Technics technics) { if (ModelState.IsValid) { db.Technics.Add(technics); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(technics)); }
/// <summary> /// Method for equal the current object with the specified object. /// </summary> /// <param name="obj">Any object</param> /// <returns>True or False</returns> public override bool Equals(object obj) { if (!(obj is Technics)) { return(false); } Technics technics = (Technics)obj; return((_type == technics.Type) && (_name == technics.Name) && (_price == technics.Price)); }
public Technics(Technics another) { Model = another._model; //SerialNumber = another.SerialNumber; Manufacturer = another.Manufacturer; Weight = another.Weight; Height = another.Height; Width = another.Width; Length = another.Length; //TechnicsCounter++; }
public void ConvertMoney_320dot9_32090() { // arrange string name1 = "smartphone"; decimal price1 = 32090; string type1 = "Technics"; Technics technics1 = new Technics(name1, type1, price1); int expected = 32090; // assert; Assert.Equal(expected, (decimal)technics1); }
// GET: Technics/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Technics technics = db.Technics.Find(id); if (technics == null) { return(HttpNotFound()); } return(View(technics)); }
public AircraftTechnics( Technics AnotherTech, int cruisingSpeed = 0, int rangeOfFlight = 0, int maxWeight = 0, int maxFlightAltitude = 0 ) : base(AnotherTech) { CruisingSpeed = cruisingSpeed; RangeOfFlight = rangeOfFlight; MaxWeight = maxWeight; MaxFlightAltitude = maxFlightAltitude; }
public AutoTechnics( Technics AnotherTech, int maxSpeed = 0, float gasMileage = 0, float liftingCapacity = 0, int serialNumber = 0 ) : base(AnotherTech) { MaxSpeed = maxSpeed; GasMileage = gasMileage; LiftingCapacity = liftingCapacity; SerialNumber = serialNumber; _technicsCounter++; }
public void CastToBook_Technicsy_Book() { // arrange string name1 = "smartphone"; decimal price1 = 320.9m; string type1 = "Technics"; Technics technics1 = new Technics(name1, type1, price1); string name2 = "smartphone"; decimal price2 = 320.9m; string type2 = "Technics"; Book book2Expected = new Book(name2, type2, price2); // assert; Assert.Equal(book2Expected, (Book)technics1); }
public void CastToTechnics_Stationery_Technics() { // arrange string name1 = "Scissors"; decimal price1 = 340m; string type1 = "stationery"; Stationery stationery1 = new Stationery(name1, type1, price1); string name2 = "Scissors"; decimal price2 = 340m; string type2 = "stationery"; Technics technics2Expected = new Technics(name2, type2, price2); // assert; Assert.Equal(technics2Expected, (Technics)stationery1); }
public void CastToTechnics_Book_Technics() { // arrange string name1 = "Рerring"; decimal price1 = 920m; string type1 = "food"; Food food1 = new Food(name1, type1, price1); string name2 = "Рerring"; decimal price2 = 920m; string type2 = "food"; Technics technics2Expected = new Technics(name2, type2, price2); // assert; Assert.Equal(technics2Expected, (Technics)food1); }
public void CastToStationery_Technics_Stationery() { // arrange string name1 = "smartphone"; decimal price1 = 320.9m; string type1 = "Technics"; Technics technics1 = new Technics(name1, type1, price1); string name2 = "smartphone"; decimal price2 = 320.9m; string type2 = "Technics"; Stationery technics2Expected = new Stationery(name2, type2, price2); // assert; Assert.Equal(technics2Expected, (Stationery)technics1); }
public void CastToFood_Technics_Food() { // arrange string name1 = "smartphone"; decimal price1 = 320.9m; string type1 = "Technics"; Technics technics1 = new Technics(name1, type1, price1); string name2 = "smartphone"; decimal price2 = 320.9m; string type2 = "Technics"; Food technics12Expected = new Food(name2, type2, price2); // assert; Assert.Equal(technics12Expected, (Food)technics1); }
public void CastToTechnics_Book_Stationery() { // arrange string name1 = "S.T.A.L.K.E.R."; decimal price1 = 560; string type1 = "book"; Book book1 = new Book(name1, type1, price1); string name2 = "S.T.A.L.K.E.R."; decimal price2 = 560; string type2 = "book"; Technics technics2Expected = new Technics(name2, type2, price2); // act // assert; Assert.Equal(technics2Expected, (Technics)book1); }
static void Main(string[] args) { var printers = new Technics(new IPrintingDevice[] { new Printer(40), new LaserPrinter(25), new LaserPrinter(30) }); printers.Add(new LaserPrinter(223)); foreach (var printer in printers) { printer.RefillCartridge(); printer.Print(); } Console.ReadLine(); }
public void Equals_TechnicsAndTechnics_Equal() { // arrange string name1 = "smartphone"; decimal price1 = 320.9m; string type1 = "Technics"; Technics technics1 = new Technics(name1, type1, price1); string name2 = "smartphone"; decimal price2 = 320.9m; string type2 = "Technics"; Technics technics2 = new Technics(name2, type2, price2); bool expected = true; // act bool actual = Equals(technics1, technics2); // assert; Assert.Equal(expected, actual); }
static void Main(string[] args) { Console.ForegroundColor = ConsoleColor.Green; string[] arm1 = new string[] { "Пушка ГШ-30-1 - 1 шт", "УР «воздух-воздух» Р-27Р - 6 шт", "УР «воздух-воздух» Р-73 - 3 шт", "авиабомбы АБ-100/АБ - 20 шт" }; string[] arm2 = new string[] { "Пушка ГШ-30-1 - 1 шт", "УР «воздух-воздух» Р-27Р - 5 шт", "УР «воздух-воздух» Р-73 - 3 шт", "авиабомбы АБ-500/АБ - 6 шт" }; string[] arm3 = new string[] { "Пушка ГШ-23Л - 1 шт", "УР «воздух-воздух» 23Л - 2 шт", "УР «воздух-воздух» 23М - 2 шт", "авиабомбы С-24Б - 2 шт" }; string[] arm4 = new string[] { "Пушка ГШ-23Л - 1 шт", "УР «воздух-воздух» 23Л - 2 шт", "УР «воздух-воздух» 23М - 2 шт", "авиабомбы С-16Б - 5 шт" }; //Technics AN_24tech = new Technics("АН - 24", "\"Завод им. Антонова\"",45, 4.5f, 17.2f,13.4f); AircraftTechnics AN_24base = new AircraftTechnics("АН-24", "\"Завод им. Антонова\"", 14.6f, 8.3f, 29.2f, 23.5f, 440, 2000, 21, 8000); AircraftTechnics IL_76base = new AircraftTechnics("ИЛ-76", "\"Авиационный комплекс имени С. В. Ильюшина\"", 145, 3.4f, 3.45f, 24.54f, 850, 5500, 195, 10200); AircraftTechnics SU_27base = new AircraftTechnics("СУ-27", "\"ОАО \"Компания «Сухой»\"", 16, 5.93f, 14.7f, 21f, 2500, 1380, 22, 18000); AircraftTechnics MIG_23base = new AircraftTechnics("МиГ-23", "\"ОКБ имени Яковлева\"", 10.5f, 5f, 7.78f, 16.7f, 2500, 1450, 20, 17700); Technics ZiL_131base = new Technics("ЗиЛ-131", "Завод им. Ленина", 6.79f, 2.9f, 2.5f, 7.04f); Technics URAL_4320base = new Technics("Урал-4320", "Автомобильный завод «УРАЛ»", 8.7f, 2.87f, 2.5f, 7.36f); AirBase Mirhorod = new AirBase("123-я истребительная бригада", "г. Миргород, Полтавская обл."); Mirhorod.addTechnic(new CargoAirplane(AN_24base, 21414, 52)); Mirhorod.addTechnic(new CargoAirplane(AN_24base, 14257, 52)); Mirhorod.addTechnic(new CargoAirplane(IL_76base, 7163455, 321)); Mirhorod.addTechnic(new Fighters(SU_27base, arm1, 123466)); Mirhorod.addTechnic(new Fighters(SU_27base, arm1, 127553)); Mirhorod.addTechnic(new Fighters(SU_27base, arm2, 229012)); Mirhorod.addTechnic(new Fighters(MIG_23base, arm3, 321456)); Mirhorod.addTechnic(new Fighters(MIG_23base, arm4, 441456)); Mirhorod.addTechnic(new AutoTechnics(ZiL_131base, 80, 41.9f, 10.5f, 23451)); Mirhorod.addTechnic(new AutoTechnics(ZiL_131base, 80, 41.9f, 10.5f, 24566)); Mirhorod.addTechnic(new AutoTechnics(URAL_4320base, 85, 45f, 15f, 11233)); Begin: Console.WriteLine($"\t\t{Mirhorod.Name}({Mirhorod.Description})\n\n" + $"\tОбщие количество техники: {Mirhorod.getAllTechCounter()}\n" + $"\tИз них :\n" + $"\tАвиотехника: {Mirhorod.getAirCounter()}\n" + $"\tАвтотехника: {Mirhorod.getAutoCount()}\n\n" + $"\tНажмите:\n" + $"\t 1 - для просмотра всей техники\n" + $"\t 2 - для просмотра авиотехники\n" + $"\t 3 - для просмотра автотехники\n" + $"\t 4 - выход из программы"); ConsoleKeyInfo keyPress = Console.ReadKey(); switch (keyPress.KeyChar) { case '1': { Console.Clear(); goto All; } case '2': { Console.Clear(); goto Avia; } case '3': { Console.Clear(); goto Auto; } case '4': { Console.Clear(); goto End; } default: { Console.Clear(); Console.WriteLine("\t\t!!! Неправильный ввод\n"); goto Begin; } } All: Console.WriteLine($"\t\t{Mirhorod.Name}({Mirhorod.Description})\n\n"); Mirhorod.ShowAllTechnics(); Console.WriteLine($"\tНажмите:\n" + $"\t 1 - для возврата в главное меню\n" + $"\t 2 - выход из программы"); keyPress = Console.ReadKey(); switch (keyPress.KeyChar) { case '1': { Console.Clear(); goto Begin; } case '2': { Console.Clear(); goto End; } default: { Console.Clear(); Console.WriteLine("\t\t!!! Неправильный ввод\n"); goto All; } } Avia: Console.WriteLine($"\t\t{Mirhorod.Name}({Mirhorod.Description})\n\n" + $"\tОбщие количество самолетов: {Mirhorod.getAirCounter()}\n" + $"\tИз них :\n" + $"\tИстребители: {Mirhorod.getFightCount()}\n" + $"\tГрузвые самолеты: {Mirhorod.getCargoCount()}\n\n" + $"\tНажмите:\n" + $"\t 1 - для просмотра истребителей\n" + $"\t 2 - для просмотра грузовых самолетов\n" + $"\t 3 - для возврата в главное меню\n" + $"\t 4 - выход из программы"); keyPress = Console.ReadKey(); switch (keyPress.KeyChar) { case '1': { Console.Clear(); goto Fighters; } case '2': { Console.Clear(); goto Cargo; } case '3': { Console.Clear(); goto Begin; } case '4': { Console.Clear(); goto End; } default: { Console.Clear(); Console.WriteLine("\t\t!!! Неправильный ввод\n"); goto Avia; } } Fighters: Console.WriteLine($"\t\t{Mirhorod.Name}({Mirhorod.Description})\n\n"); // $"\tИстребители:\n"); Mirhorod.ShowFighters(); Console.WriteLine($"\tНажмите:\n" + $"\t 1 - для просмотра авиотехники\n" + $"\t 2 - для возврата в главное меню\n" + $"\t 3 - выход из программы"); keyPress = Console.ReadKey(); switch (keyPress.KeyChar) { case '1': { Console.Clear(); goto Avia; } case '2': { Console.Clear(); goto Begin; } case '3': { Console.Clear(); goto End; } default: { Console.Clear(); Console.WriteLine("\t\t!!! Неправильный ввод\n"); goto Fighters; } } Cargo: Console.WriteLine($"\t\t{Mirhorod.Name}({Mirhorod.Description})\n\n"); Mirhorod.ShowCargo(); Console.WriteLine($"\tНажмите:\n" + $"\t 1 - для просмотра авиотехники\n" + $"\t 2 - для возврата в главное меню\n" + $"\t 3 - выход из программы"); keyPress = Console.ReadKey(); switch (keyPress.KeyChar) { case '1': { Console.Clear(); goto Avia; } case '2': { Console.Clear(); goto Begin; } case '3': { Console.Clear(); goto End; } default: { Console.Clear(); Console.WriteLine("\t\t!!! Неправильный ввод\n"); goto Cargo; } } Auto: Console.WriteLine($"\t\t{Mirhorod.Name}({Mirhorod.Description})\n\n"); Mirhorod.ShowAuto(); Console.WriteLine($"\tНажмите:\n" + $"\t 1 - для возврата в главное меню\n" + $"\t 2 - выход из программы"); keyPress = Console.ReadKey(); switch (keyPress.KeyChar) { case '1': { Console.Clear(); goto Begin; } case '2': { Console.Clear(); goto End; } default: { Console.Clear(); Console.WriteLine("\t\t!!! Неправильный ввод\n"); goto Auto; } } End : Console.WriteLine("\n\t\tДо свидания\n"); }