private static void CheckTheManufacturer(string manufacturer, ref PersonalComputer pc, ref Laptop laptop, ref Server server) { if (manufacturer == "HP") { var hpManufacturer = new HPManufacturer(); var factoryManager = new FactoryManager(hpManufacturer); pc = factoryManager.MakePersonalComputer(); laptop = factoryManager.MakeLaptop(); server = factoryManager.MakeServer(); } else if (manufacturer == "Dell") { var dellManufacturer = new DellManufacturer(); var factoryManager = new FactoryManager(dellManufacturer); pc = factoryManager.MakePersonalComputer(); laptop = factoryManager.MakeLaptop(); server = factoryManager.MakeServer(); } else if (manufacturer == "Lenovo") { var lenovoManufacturer = new LenovoManufacturer(); var factoryManager = new FactoryManager(lenovoManufacturer); pc = factoryManager.MakePersonalComputer(); laptop = factoryManager.MakeLaptop(); server = factoryManager.MakeServer(); } else { throw new ArgumentException("Invalid manufacturer!"); } }
public void LoadRamValue_LoadValueWhenIsEmpty_MustReturnZero() { var dellManufacturer = new DellManufacturer(); var factoryManager = new FactoryManager(dellManufacturer); var pc = factoryManager.MakePersonalComputer(); var result = pc.RamOfComputer.LoadValue(); Assert.AreEqual(0, result); }
public void CPUSquareNumberTests_SquareNumberOf16() { var dellManufacturer = new DellManufacturer(); var factoryManager = new FactoryManager(dellManufacturer); var pc = factoryManager.MakePersonalComputer(); var result = pc.CpuOfComputer.SquareNumber(16); Assert.AreEqual("Square of 16 is 256.", result); }
public void SaveRamValue_SaveValueWhenIsEpmty_MustReturnFive() { var dellManufacturer = new DellManufacturer(); var factoryManager = new FactoryManager(dellManufacturer); var pc = factoryManager.MakePersonalComputer(); pc.RamOfComputer.SaveValue(5); var result = pc.RamOfComputer.LoadValue(); Assert.AreEqual(5, result); }
public void BatteryChargeTest_FullEmptyTheBatteryWith200_MustReturnZero() { var dellManufacturer = new DellManufacturer(); var factoryManager = new FactoryManager(dellManufacturer); var laptop = factoryManager.MakeLaptop(); laptop.LaptopBattery.Charge(-200); var result = laptop.LaptopBattery.Percentage; Assert.AreEqual(0, result); }
public void BatteryChargeTest_OverchargeWith200Percents_MustReturn100() { var dellManufacturer = new DellManufacturer(); var factoryManager = new FactoryManager(dellManufacturer); var laptop = factoryManager.MakeLaptop(); laptop.LaptopBattery.Charge(200); var result = laptop.LaptopBattery.Percentage; Assert.AreEqual(100, result); }
public void BatteryChargeTest_FullChargingTheBatteryFromZero_MustReturn100() { var dellManufacturer = new DellManufacturer(); var factoryManager = new FactoryManager(dellManufacturer); var laptop = factoryManager.MakeLaptop(); laptop.LaptopBattery.Charge(-200); laptop.LaptopBattery.Charge(100); var result = laptop.LaptopBattery.Percentage; Assert.AreEqual(100, result); }