예제 #1
0
    static void Main()
    {
        Shop shop = new Shop(3);
        shop[0] = new Laptop("Asus", 4900);
        shop[1] = new Laptop("Acer", 3300);
        shop[2] = new Laptop("Dell", 2900);

        try
        {
            //for (int i = 0; i < shop.Length; i++)
            //{
            //    Console.WriteLine(shop[i].ToString());
            //}
            foreach (Laptop lt in shop)
            {
                Console.WriteLine(lt.ToString());
            }

            Console.WriteLine("===================");
            //Console.WriteLine(shop["Asus"]);
            //double p = 4900;
            Console.WriteLine(shop[(double)4900]);
        }
        catch (Exception ex)
        {
            Console.WriteLine(ex.Message);
        }
    }
예제 #2
0
파일: Program.cs 프로젝트: unbelt/SoftUni
    static void Main()
    {
        Laptop laptop1 = new Laptop(
            model: "Lenovo Yoga 2 Pro",
            price: 650.00m
        );

        Console.WriteLine(laptop1.ToString());

        Laptop laptop2 = new Laptop(
            model: "Lenovo Yoga 2 Pro",
            manufacturer: "Lenovo",
            processor: "Intel Core i5-4210U (2-core, 1.70 - 2.70 GHz, 3MB cache)",
            ram: 8,
            graphicsCard: "Intel HD Graphics 4400",
            hdd: "128GB SSD",
            screen: "13.3\" (33.78 cm) – 3200 x 1800 (QHD+), IPS sensor display",
            batteryDescription: "Li-Ion, 4-cells, 2550 mAh",
            batteryLifeInHours: 4.5,
            price: 2259.00m
        );

        Console.WriteLine(laptop2.ToString());
        Console.WriteLine();

        Laptop laptop3 = new Laptop(
            model: "Lenovo Yoga 2 Pro",
            ram: 8,
            hdd: "128GB SSD",
            screen: "13.3\" (33.78 cm) – 3200 x 1800 (QHD+), IPS sensor display",
            price: 2259.00m
        );

        Console.WriteLine(laptop3.ToString());
    }
 static void Main()
 {
     Laptop laptop1 = new Laptop("Toshiba Satellite L850-13R", 200);
     Console.WriteLine(laptop1.ToString());
     Laptop laptop2 = new Laptop("Lenovo Yoga 2 Pro", 2259.00, "Lenovo", "Intel Core i5-4210U (2-core, 1.70 - 2.70 GHz, 3MB cache)", "8 GB", "128GB SSD", "Intel HD Graphics 4400", "13.3\" (33.78 cm) – 3200 x 1800 (QHD+), IPS sensor display", "Li-Ion, 4-cells, 2550 mAh","4.5 hours");
     Console.WriteLine(laptop2.ToString());
 }
        internal static void Main()
        {
            // 1st test option:
            // You can run the Unit Tests from the Visual Studio menu:
            // BUILD -> Build Solution
            // TEST -> Windows -> Test Explorer (you will see in the Test Explorer window: Not Run Tests or Passed Tests
            // and above it:  Run All
            // Please, click on Run All, and read the ClassLaptopTests.cs file for more details

            // 2nd test option: Ctrl + F5
            // test object creation with full info
            var laptopWithFullInfo = new Laptop(
                "Lenovo Yoga 2 Pro",
                2259.00m,
                "Lenovo",
                "13.3 inches (33.78 cm) – 3200 x 1800 (QHD+), IPS sensor display)",
                "Intel Core i5-4210U (2-core, 1.70 - 2.70 GHz, 3MB cache)",
                "8 GB",
                "128GB SSD",
                "Intel HD Graphics 4400",
                new Battery("Li-Ion", 4, 2550, 4.5));

            Console.WriteLine(laptopWithFullInfo);

            // test object creation with mandatory info
            var laptopWithMandatoryInfoOnly = new Laptop("HP 250 G2", 699.00m);

            Console.WriteLine(laptopWithMandatoryInfoOnly);
        }
예제 #5
0
 static void Main()
 {
     Laptop ivan = new Laptop("ivan", "ivan", "ivan", 9, "ivan", 3929);
     Laptop pesho = new Laptop("ivan", "s", "s", 2, "2", "3", "2", "22", 4, 123123);
     Console.WriteLine(ivan);
     Console.WriteLine(pesho);
 }
        public void ScreenSizeShouldBeZeroWhenNotSet()
        {
            var laptop = new Laptop("VN7-591G", "Acer Aspire", "Intel Core i7-4710HQ",
                "NVIDIA GeForce GTX 860M", "8 cells");

            Assert.AreEqual(0, laptop.ScreenSize);
        }
예제 #7
0
 static void Main()
 {
     Laptop dell = new Laptop("Lenovo Yoga", "Lenovo", "Intel Core i5- 4210U", "8 GB", "Intel HD Graphics 4400", "128GB SSD", "13.3", "Li-Ion, 4-cells 2550 mAh", 4.5, 2259.00m);
     Laptop lenovo = new Laptop("Dell Vostro", 1112);
     Console.WriteLine(dell);
     Console.WriteLine(lenovo);
 }
예제 #8
0
    static void Main()
    {
        var battery = new Battery("Li-Ion, 4-cells, 2550 mAh", "4.5 hours");
        var laptop = new Laptop("Lenovo Yoga 2 Pro", "2259.00 lv.", "Intel HD Graphics 4400", "128GB SSD", battery);

        Console.WriteLine(laptop.ToString());
    }
예제 #9
0
파일: Shop.cs 프로젝트: zhecho1215/Softuni
 public static void Main()
 {
     Laptop firstLaptop = new Laptop("toshiba", 123.23m);
     Laptop secondLaptop = new Laptop("W500", 420.420m, "Lenovo", "i10 10ghz", "69 GB", "GTX 420", "1TB", "Mat", new Battery("123 mha", 24));
     Console.WriteLine(firstLaptop);
     Console.WriteLine();
     Console.WriteLine(secondLaptop);
 }
예제 #10
0
    static void Main()
    {
        var laptopOne = new Laptop("Lenovo Yoga 2 Pro", 541.2531);
        var laptopTwo = new Laptop("Lenovo Yoga 2 Pro", "Lenovo", new Battery("Li-Ion, 4-cells, 2550 mAh", 4.5), "Intel Core i5-4210U (2-core, 1.70 - 2.70 GHz, 3MB cache)", 8, "Intel HD Graphics 4400", "128GB SSD", "13.3(33.78 cm) – 3200 x 1800 (QHD+), IPS sensor display", 2259.002124);

        Console.WriteLine(laptopOne);
        Console.WriteLine("-----------------------------------------------");
        Console.WriteLine(laptopTwo);
    }
예제 #11
0
    static void Main()
    {
        Laptop laptop = new Laptop("Lenovo Yoga 2 Pro", "Lenovo", "Intel Core i5-4210U (2-core, 1.70 - 2.70 GHz, 3MB cache)", 8, "Intel HD Graphics 4400", "128GB SSD", "13.3\" (33.78 cm) – 3200 x 1800 (QHD+), IPS sensor display", new Battery("Li-Ion, 4-cells, 2550 mAh", 4.5), 2259.00);

        Laptop laptop2 = new Laptop("Lenovo Yoga 2 Pro", "Lenovo");
        Console.WriteLine(laptop);
        Console.WriteLine();
        Console.WriteLine(laptop2);
    }
        public void ToStringMethodShouldFormatPropertiesCorrectly()
        {
            var laptop = new Laptop("VN7-591G", "Acer Aspire", "Intel Core i7-4710HQ",
                "NVIDIA GeForce GTX 860M", "8 cells", 4, 15.6, 1959);

            var result = laptop.ToString();

            var expected = string.Format("Laptop: Acer Aspire VN7-591G{0}Processor: Intel Core i7-4710HQ{0}Graphics card: NVIDIA GeForce GTX 860M{0}Screen size: 15,6 inches{0}Price: 1959 lv{0}Battery: 8 cells (4 hours)", Environment.NewLine);
            Assert.AreEqual(result, expected, "Wrong ToString() formatting");
        }
예제 #13
0
        private static void CreateComputers()
        {
            var manufacturerName = Console.ReadLine();
            var manufacturerFactory = new ManufacturerFactory();
            IComputersFactory computerFactory = manufacturerFactory.GetManufacturer(manufacturerName);

            pc = computerFactory.CreatePersonalComputer();
            laptop = computerFactory.CreateLaptop();
            server = computerFactory.CreateServer();
        }
 public Laptop CreateLaptop()
 {
     var laptop = new Laptop(
         new Cpu64(2),
         new Ram(16),
         new[] { new SingleHardDrive(1000) },
         new ColorfulVideoCard(),
         new LaptopBattery());
     return laptop;
 }
예제 #15
0
    static void Main()
    {
        Battery battery = new Battery();
        Laptop Laptop = new Laptop("Pro 720", "Asus", "Intel i7 4.1 GHz", "4GB KINGSTON", "NVidia GForce 2GB", "500 TB", "15.6h", battery, 1000, 2000m);
        Console.WriteLine(Laptop.ToString());

        Console.WriteLine("-----------------");

        Laptop OtherLaptop = new Laptop("Satelite PRO", 1248.00m);
        Console.WriteLine(OtherLaptop.ToString());
    }
예제 #16
0
        static void Main(string[] args)
        {
            Laptop asusX100 = new Laptop("X100", "Asus", "Intel Core i5-4210U (2-core, 1.70 - 2.70 GHz, 3MB cache)",
                                        "16 GB", "Nvidia GeForce 7600", "128GB SSD",
                                        "13.3'(33.78 cm) – 3200 x 1800(QHD +), IPS sensor display",
                                        new Battery(4, 2500,BatteryType.LiIon), 4.5,2200);

            Laptop lenovog570 = new Laptop("g570", 600);

            Console.WriteLine(asusX100);
        }
예제 #17
0
        public Laptop CreateLaptop()
        {
            var laptop = new Laptop(
                new Cpu32(4),
                new Ram(8),
                new[] { new SingleHardDriver(1000) },
                new ColorVideoCard(),
                new LaptopBattery());

            return laptop;
        }
예제 #18
0
        private IComputer ManufactureLaptop()
        {
            Ram ram = new Ram(16);
            HardDrive hardDrive = new HardDrive(1000, false, 0);
            IEnumerable<HardDrive> hardDrives = new List<HardDrive>() { hardDrive };
            IVideoCard videoCard = new ColorfulVideoCard();
            LaptopBatery battery = new LaptopBatery();
            ICpu cpu = new Cpu(2, CpuType.Bits64, new Motherboard(ram, videoCard));
            IComputer laptop = new Laptop(cpu, ram, hardDrives, videoCard, battery);

            return laptop;
        }
예제 #19
0
    static void Main()
    {
        Laptop lenovo = new Laptop("Lenovo Yoga 2 Pro", 2259);
        Console.WriteLine(lenovo);

        Console.WriteLine();

        Battery lion = new Battery("Li-Ion, 4 cells, 2550mAh", (float)5.5);

        Laptop dell = new Laptop("Dell Inspiron", 3425, "Dell", "Intel 2955U 1.40 GHz, 2 MB cache",
            8, "Intel HD Graphics 4400", 1500, "18\"", lion);
        Console.WriteLine(dell);
    }     
예제 #20
0
 static void Main(string[] args)
 {
     Battery battery1 = new Battery("Li-Ion, 4-cells, 2550 mAh", (float)4.5);
     Laptop laptop1 = new Laptop("Lenovo Yoga 2 Pro", (decimal)2259.00, "Lenovo", "Intel Core i5-4210U (2-core, 1.70 - 2.70 GHz, 3MB cache)", "8 GB", "Intel HD Graphics 4400", "128GB SSD", "13.3\" (33.78 cm) – 3200 x 1800 (QHD+), IPS sensor display", battery1);
     Console.WriteLine(laptop1);
     Console.WriteLine("------------------------------------------------------------------------");
     Battery battery2 = new Battery("Li-Ion");
     Laptop laptop2 = new Laptop("Lenovo G580", (decimal)1000.00, null, null, null, null, null, null, battery2);
     Console.WriteLine(laptop2);
     Console.WriteLine("------------------------------------------------------------------------");
     Battery battery3 = new Battery("Li-Ion, 6-cells, 4550 mAh", (float)7.5);
     Laptop laptop3 = new Laptop("MacBook Pro", (decimal)3500.00, "Apple", null, "16GB", null, null, null, battery3);
     Console.WriteLine(laptop3);
 }
예제 #21
0
    static void Main()
    {
        Battery batt = new Battery("6-cell", 4.27);
        Laptop laptop = new Laptop("Dell Inspiron 3537", (decimal)978.00, "Dell", batt, "Intel Core i5-4200U", "8GB DDR 3 1600", "AMD Radeon HD 8670M", "500GB HDD", "15.6 inch");

        Console.WriteLine(laptop);

        laptop = new Laptop("Acer E255", 1200m);
        Console.WriteLine(laptop);
     
        laptop = new Laptop("Lenovo 344A", 1444.23m, "Lenovo", battery: batt, screen: "17.0 inch");
        Console.WriteLine(laptop);
        
    }
예제 #22
0
    static void Main(string[] args)
    {
        Laptop laptop = new Laptop("Dell entry", 699.00m);
        Console.WriteLine(laptop.ToString());

        //All arguments
        Laptop laptop2 = new Laptop("Dell highend", "Dell", "Intel Core i7-4210U (4-core, 1.70 - 2.70 GHz)", 8, "Nvidia 740M", "128GB SSD", "13.3\"", "Li-Ion, 4-cells, 2550 mAh", 4.5, 1999.00m);
        Console.WriteLine(laptop2.ToString());

        //Part of the arguments
        Laptop laptop3 = new Laptop("Alienware", "6-core, 4.4GHz", 32, "4TB HDD, 512GB SSD", 5499.00m);
        laptop3.Manufacturer = "Dell";
        Console.WriteLine(laptop3.ToString());
    }
예제 #23
0
    static void Main()
    {
        Laptop withBasicInfoOnly = new Laptop("N750JV", 2000.233m);
        Console.WriteLine(withBasicInfoOnly);

        Laptop withFullInfo = new Laptop("ThinkPad T60", 280.00m, "Lenovo", "Intel DualCore", "4 GB", "Intel HD Graphics 4600", "80GB WD 5400 rpm", new Battery("Li-Ion", 1.5));
        Console.WriteLine(withFullInfo);


        /*----- INVALID LINES OF CODE -----*/

        // Laptop withEmptyModel = new Laptop("", 500);
        // Laptop withNegativePrice = new Laptop("HP", -2.0m);       
        // Laptop withNegativeBatteryLife = new Laptop("a", 100, "a", new Battery("a", -1));        
    }
예제 #24
0
 static void Main(string[] args)
 {
     Battery myBattery = new Battery("Li-Ion, 4-cells, 2550 mAh", 45);
     Laptop firstLaptop = new Laptop("Lenovo Yoga 2 Pro", "Lenovo"
         , "Intel Core i5-4210U (2-core, 1.70 - 2.70 GHz, 3MB cache)"
         , 8
         , "Intel HD Graphics 4400"
         , "128GB SSD"
         , "13.3 (33.78 cm) – 3200 x 1800(QHD +), IPS sensor display"
         , myBattery
         ,2259.00m);
     Laptop secondLaptop = new Laptop("Apple", 1234124.13513m);
     Console.WriteLine(firstLaptop);
     Console.WriteLine(secondLaptop);
 }
    public static void Main()
    {
        Laptop fullLaptop = new Laptop(
            "Lenovo Yoga 2 Pro", 
            "Lenovo",
            "Intel Core i5-4210U (2-core, 1.70 - 2.70 GHz, 3MB cache)",
            8,
            "Intel HD Graphics 4400", 
            "128GB SSD", "13.3\" (33.78 cm) – 3200 x 1800 (QHD+), IPS sensor display",
            new Battery("Li-Ion, 4-cells, 2500 mAh", 4.5),
            2259);
        Laptop simpleLaptop = new Laptop("HP 250 G2", 699);

        Console.WriteLine(fullLaptop);
        Console.WriteLine(simpleLaptop);
    }
예제 #26
0
파일: LaptopShop.cs 프로젝트: mkmirchev/OOP
 static void Main()
 {
     var notebookFullInfo = new Laptop(
           "Lenovo Yoga 2 Pro",
             2259.00m,
             "Lenovo",
             "Intel Core i5-4210U (2-core, 1.70 - 2.70 GHz, 3MB cache)",
             "8 GB",
             "Intel HD Graphics 4400",
             "128GB SSD",
             "13.3 inches (33.78 cm) – 3200 x 1800 (QHD+), IPS sensor display)",
             new Battery("Li-Ion", 4, 4.5));
     var notebookMandatoryInfo = new Laptop("HP 250 G2", 699.0m);
     Console.WriteLine(notebookFullInfo);
     Console.WriteLine();
     Console.WriteLine(notebookMandatoryInfo);
 }
예제 #27
0
파일: Shop.cs 프로젝트: krasi070/OOP
    static void Main()
    {
        Laptop[] laptops = new Laptop[2];
        laptops[0] = new Laptop("Lenovo Yoga 2 Pro", "Lenovo",
            "Intel Core i5-4210U (2-core, 1.70 - 2.70 GHz, 3MB cache)", "8 GB", "Intel HD Graphics 4400",
            "128GB SSD", "13.3\" (33.78 cm) – 3200 x 1800 (QHD+), IPS sensor display",
            new Battery("Li-Ion, 4-cells, 2550 mAh", 4.5), 2259.00);
        laptops[1] = new Laptop("THE NEW RAZER BLADE PRO", 4999.99);

        foreach (var laptop in laptops)
        {
            Console.WriteLine(laptop.ToString());

            if (!laptop.Equals(laptops[laptops.Length - 1]))
            {
                Console.WriteLine();
            }
        }
    }
예제 #28
0
    static void Main()
    {
        var mandatoryLaptop = new Laptop("HP 250 G2", (decimal)699.00);

        var fullLaptop = new Laptop("Lenovo Yoga 2 Pro", (decimal)2259.00)
        {
            Manufacturer = "Lenovo",
            Processor = "Intel Core i5-4210U (2-core, 1.70 - 2.70 GHz, 3MB cache)",
            RAM  = 8,
            GraphicsCard = "Intel HD Graphics 4400",
            HDD = "128GB SSD",
            Screen = "13.3\" (33.78 cm) – 3200 x 1800 (QHD+), IPS sensor display",
            Battery = new Battery("Li-Ion, 4-cells, 2550 mAh", 4.5)
        };

        Console.WriteLine(mandatoryLaptop);
        Console.WriteLine();
        Console.WriteLine(fullLaptop);
    }
예제 #29
0
    public static void Main(string[] args)
    {
        Laptop laptop = new Laptop("HP 250 G4",
            "HP",
            "Intel Core i3-4005U (2-ядрен, 1.70 GHz)",
            "8 GB DDR3 1600Mhz",
            "AMD Radeon R5 M330 (2gb ddr)",
            "1TB SSD HDD (5400rPM/m)",
            "15.6-инчов (39.62 см) - 1366x768, матов",
            new Battery(BatteryType.NiCad, 3, 2550),
            4.5,
            819
            );

        Laptop laptop2 = new Laptop();

        Console.WriteLine(laptop);
        Console.WriteLine(laptop2);
    }
예제 #30
0
        public static Laptop CreateLaptop(LaptopType type)
        {
            Laptop laptop = null;

            switch (type)
            {
            case LaptopType.MAC:
                laptop = new MacLaptop();
                break;

            case LaptopType.LENOVO:
                laptop = new LenovoLaptop();
                break;

            default:
                break;
            }

            return(laptop);
        }
예제 #31
0
    public static void ProcessInput()
    {
        int n = Convert.ToInt32(Console.ReadLine());

        var nameValue = new List <Laptop>();

        for (int index = 0; index < n; index++)
        {
            var laptop    = new Laptop();
            var arguments = Console.ReadLine().Split(' ');

            laptop.Name        = arguments[0];
            laptop.Value       = Convert.ToInt32(arguments[1]);
            laptop.ValueString = arguments[1];

            nameValue.Add(laptop);
        }

        Console.WriteLine(GetMinimumPriceLaptopOnly7And4(nameValue));
    }
예제 #32
0
        public Laptop AddRecord(int id)
        {
            string xmlData = "<Laptop>" +
                             "<BrandName>Alienware</BrandName>" +
                             "<Features>" +
                             "<Feature>8th Generation Intel® Core™ i5 - 8300H</Feature>" +
                             "<Feature>Windows 10 Home 64 - bit English</Feature>" +
                             "<Feature>NVIDIA® GeForce® GTX 1660 Ti 6GB GDDR6</Feature>" +
                             "<Feature>8GB, 2x4GB, DDR4, 2666MHz</Feature>" +
                             "</Features>" +
                             "<Id> " + id + "</Id>" +
                             "<LaptopName>Alienware M17</LaptopName>" +
                             "</Laptop>";
            RestResponse restResponse = HttpClientHelper.PerformPostRequest(postUrl, xmlData, xmlMediaType, headers);

            Assert.AreEqual(200, restResponse.StatusCode);
            Laptop xmlDatat = ResponseDataHelper.DeserializeXmlResponse <Laptop>(restResponse.ResponseContent);

            return(xmlDatat);
        }
예제 #33
0
        public Laptop UpdateLaptop(int LaptopId, Laptop Laptop)
        {
            Laptop ExistingLaptop = _laptopRepository.FindById(LaptopId);

            if (ExistingLaptop == null)
            {
                return(null);
            }

            ExistingLaptop.Brand    = Laptop.Brand;
            ExistingLaptop.CPU      = Laptop.CPU;
            ExistingLaptop.Employee = Laptop.Employee;
            ExistingLaptop.OS       = Laptop.OS;
            ExistingLaptop.RAM      = Laptop.RAM;

            _laptopRepository.Update(ExistingLaptop);
            _laptopRepository.SaveChanges();

            return(ExistingLaptop);
        }
        public void GetById_Should_Return_Selected_Laptops()
        {
            var laptop = new Laptop
            {
                HardDiskSize   = 500,
                ImageUrl       = @"~/images/laptopImage.jpg",
                Model          = "EliteBook 8760w",
                MonitorSize    = 15.6,
                Price          = 1600,
                RamMemorySize  = 6,
                ManufacturerId = 2
            };

            this.data.Laptops.Add(laptop);
            this.data.SaveChanges();

            var expected = this.data.Laptops.GetById(laptop.Id);

            Assert.AreSame(expected, laptop, "Laptop's repository GetById method returns different laptop than expected.");
        }
예제 #35
0
        public async Task <int> AddLaptop(LaptopModel laptopModel, string email)
        {
            try
            {
                laptopModel.UserId = (await _context.Users.FirstOrDefaultAsync(user => user.Email == email)).Id;
                var laptop = new Laptop(laptopModel);
                var id     = await AddGoodData(laptopModel.ImageIds, laptop);
                await AddLaptopComputerDriveType(laptopModel.ComputerDriveTypes, id);

                await _context.Laptops.AddAsync(laptop);

                await _context.SaveChangesAsync();

                return(1);
            }
            catch (Exception)
            {
                throw;
            }
        }
예제 #36
0
        public static void Main()
        {
            Laptop mandatoryLaptop = new Laptop("HP 250 G2", 699.00M);
            Console.WriteLine(mandatoryLaptop);

            Console.WriteLine();

            Laptop fullLaptop = new Laptop("Lenovo Yoga 2 Pro", 699.00M, "Lenovo",
                "Intel Core i5-4210U (2-core, 1.70 - 2.70 GHz, 3MB cache)", 8, "Intel HD Graphics 4400",
                128, "13.3 (33.78 cm) – 3200 x 1800 (QHD+), IPS sensor display",
                new Battery("Li-Ion, 4-cells, 2550 mAh", 4.5));
            Console.WriteLine(fullLaptop);

            Console.WriteLine();

            Laptop partialLaptop = new Laptop("Lenovo Yoga 2 Pro", 699.00M, "Lenovo", // No battery and screen
                "Intel Core i5-4210U (2-core, 1.70 - 2.70 GHz, 3MB cache)", 8, "Intel HD Graphics 4400",
                128);
            Console.WriteLine(partialLaptop);
        }
예제 #37
0
        public void Sua()
        {
            Console.Clear();
            Console.WriteLine("SUA THONG TIN LAPTOP");
            List <Laptop> list = ltDLL.GetAllLaptop();
            string        maLaptop;

            Console.Write("Nhap ma Laptop can sua:");
            maLaptop = Console.ReadLine();
            int i = 0;

            for (i = 0; i < list.Count; ++i)
            {
                if (list[i].MaLT == maLaptop)
                {
                    break;
                }
            }

            if (i < list.Count)
            {
                Laptop lt = new Laptop(list[i]);
                Console.Write("Nhap Ma moi:");
                string ma = Console.ReadLine();
                if (!string.IsNullOrEmpty(ma))
                {
                    lt.MaLT = ma;
                }
                Console.Write("Gia moi:");
                int gia = int.Parse(Console.ReadLine());
                if (gia > 0)
                {
                    lt.DonGia = gia;
                }
                ltDLL.SuaLaptop(lt);
            }
            else
            {
                Console.WriteLine("Khong ton tai ma san pham nay");
            }
        }
        public ActionResult Create(FormCollection fc, HttpPostedFileBase file)
        {
            var    allowedExtensions = new[] { ".jpg" };
            Laptop laptop            = new Laptop();

            laptop.CATEGORY   = (Category)Enum.Parse(typeof(Category), fc["CATEGORY"]);
            laptop.Name       = fc["Name"].ToString();
            laptop.CPU        = fc["CPU"];
            laptop.RAM        = fc["RAM"];
            laptop.CPU_MODEL  = fc["CPU_MODEL"];
            laptop.STORAGE    = fc["STORAGE"];
            laptop.SCREEN     = fc["SCREEN"];
            laptop.OS         = fc["OS"];
            laptop.OTHER_SPEC = fc["OTHER_SPEC"];
            laptop.PRICE      = Int32.Parse(fc["PRICE"]);

            var fileName = Path.GetFileName(file.FileName);  //just file name
            var ext      = Path.GetExtension(file.FileName); //getting the extension(ex-.jpg)

            if (allowedExtensions.Contains(ext))             //check what type of extension
            {
                //we don't use this name, we use according to laptop name
                //string name = Path.GetFileNameWithoutExtension(fileName); //getting file name without extension
                string myfile = fc["Name"] + ext;                                    //appending the name with id  (aa.jpg)

                var path = Path.Combine(Server.MapPath("~/Images/Laptops"), myfile); // store the file inside ~/project folder(Img)
                //tbl.Image_url = path;
                if (ModelState.IsValid)
                {
                    db.Laptops.Add(laptop);
                    db.SaveChanges();
                    file.SaveAs(path);
                    return(RedirectToAction("Index", new { page = Convert.ToInt32(db.Laptops.ToList().Count() / DEFAULT_INVENTORY_PAGE_SIZE) }));
                }
            }
            else
            {
                ViewBag.message = "Please choose only Image file";
            }
            return(View());
        }
예제 #39
0
        static void Main()
        {
            try
            {
                Boss   hero = new Boss();
                Laptop L1   = new Laptop();
                Radio  R1   = new Radio();
                TV     T1   = new TV();


                D d1 = T1.OnTurnOn;
                d1.Invoke(4);
                //d1 += T1.OnTurnOn;


                L1.broken    = true;
                hero.TurnOn += L1.OnTurnOn;
                hero.TurnOn += R1.OnTurnOn;
                hero.TurnOn += T1.OnTurnOn;
                hero.TurnOn += n => Console.WriteLine("Приборы включаются под напряжением " + n);

                hero.CommandTurnOn(4);

                /*hero.brokenMen = true;
                *  hero.Upgrade += T1.OnUpgrade;
                *
                *  hero.CommandUpgrade();*/


                Console.WriteLine();

                string str = "I'm mr. DavKidson, jusKt Ksent you an e-mail. I hope, you will see it.";
                string res = UpgradeString(str);
                Console.WriteLine(res);
                Console.ReadLine();
            }
            catch (System.FormatException)
            {
                Console.WriteLine("Исключение! Неверный формат.");
            }
        }
예제 #40
0
        public List <Laptop> TimLaptop(Laptop lt)
        {
            List <Laptop> list = GetAllLaptop();
            List <Laptop> kq   = new List <Laptop>();

            if (string.IsNullOrEmpty(lt.MaLT) &&
                string.IsNullOrEmpty(lt.TenLT) &&
                string.IsNullOrEmpty(lt.Mau) &&
                lt.DonGia == 0)
            {
                kq = list;
            }
            //Tim theo ten sp
            if (!string.IsNullOrEmpty(lt.TenLT))
            {
                for (int i = 0; i < list.Count; ++i)
                {
                    if (list[i].TenLT.IndexOf(lt.TenLT) >= 0)
                    {
                        kq.Add(new Laptop(list[i]));
                    }
                }
            }

            //Tim theo gia
            else if (lt.DonGia > 0)
            {
                for (int i = 0; i < list.Count; ++i)
                {
                    if (list[i].DonGia == lt.DonGia)
                    {
                        kq.Add(new Laptop(list[i]));
                    }
                }
            }
            else
            {
                kq = null;
            }
            return(kq);
        }
예제 #41
0
        public void TestPostEndpointWithXml()
        {
            int    id      = random.Next(1000);
            string xmlData = "<Laptop>" +
                             "<BrandName>Alienware</BrandName>" +
                             "<Features>" +
                             "<Feature>8th Generation Intel® Core™ i5-8300H</Feature>" +
                             "<Feature>Windows 10 Home 64-bit English</Feature>" +
                             "<Feature>NVIDIA® GeForce® GTX 1660 Ti 6GB GDDR6</Feature>" +
                             "<Feature>8GB, 2x4GB, DDR4, 2666MHz</Feature>" +
                             "</Features>" +
                             "<Id>" + id + "</Id>" +
                             "<LaptopName>Alienware M17</LaptopName>" +
                             "</Laptop>";

            using (HttpClient httpClient = new HttpClient())
            {
                HttpContent content = new StringContent(xmlData, Encoding.UTF8, xmlMediaType);
                Task <HttpResponseMessage> httpResponseMessage = httpClient.PostAsync(postUrl, content);
                HttpStatusCode             statusCode          = httpResponseMessage.Result.StatusCode;
                HttpContent responseContent = httpResponseMessage.Result.Content;
                string      responseData    = responseContent.ReadAsStringAsync().Result;

                restResponse = new RestResponse((int)statusCode, responseData);
                Assert.AreEqual(200, restResponse.StatusCode);
                Assert.IsNotNull(restResponse.ResponseData, "Response data is null/empty");

                httpResponseMessage = httpClient.GetAsync(getUrl + id);
                if (!httpResponseMessage.Result.IsSuccessStatusCode)
                {
                    Assert.Fail("the Http response was not successfull");
                }

                restResponse = new RestResponse((int)httpResponseMessage.Result.StatusCode, httpResponseMessage.Result.Content.ReadAsStringAsync().Result);
                XmlSerializer xmlSerializer = new XmlSerializer(typeof(Laptop));
                TextReader    textReader    = new StringReader(restResponse.ResponseData);
                Laptop        xmlObj        = (Laptop)xmlSerializer.Deserialize(textReader);

                Assert.AreEqual("Alienware", xmlObj.BrandName);
            }
        }
예제 #42
0
        public string AddComputer(string computerType, int id, string manufacturer, string model, decimal price)
        {
            if (!Enum.IsDefined(typeof(ComputerType), 1) && !Enum.IsDefined(typeof(ComputerType), 2))
            {
                throw new ArgumentException(ExceptionMessages.InvalidComputerType);
            }

            IComputer computer = null;

            if (computerType == "Laptop")
            {
                computer = new Laptop(id, manufacturer, model, price);
            }
            else if (computerType == "DesktopComputer")
            {
                computer = new DesktopComputer(id, manufacturer, model, price);
            }

            computers.Add(computer);
            return(string.Format(SuccessMessages.AddedComputer, id));
        }
예제 #43
0
        //--------------------TV---------------------
        public void CreateLaptop(LaptopDTO laptopDto)
        {
            if (laptopDto == null)
            {
                throw new ValidationException("При добавлении нового ноутбука произошла ошибка. Экземпляр объекта LaptopDTO равен null.", "");
            }
            if (laptopDto.OrderSellerId == 0)
            {
                throw new ValidationException("Заказ продавца не найден", "");
            }

            var    mapper = new MapperConfiguration(cfg => cfg.CreateMap <LaptopDTO, Laptop>()).CreateMapper();
            Laptop laptop = mapper.Map <LaptopDTO, Laptop>(laptopDto);

            OrderSeller seller = Database.OrderSellers.Get(laptopDto.OrderSellerId);

            laptop.OrderSeller = seller;

            Database.Laptops.Create(laptop);
            Database.Save();
        }
예제 #44
0
    public static void Main(string[] args)
    {
        Laptop laptop = new Laptop("HP 250 G4",
                                   "HP",
                                   "Intel Core i3-4005U (2-ядрен, 1.70 GHz)",
                                   "8 GB DDR3 1600Mhz",
                                   "AMD Radeon R5 M330 (2gb ddr)",
                                   "1TB SSD HDD (5400rPM/m)",
                                   "15.6-инчов (39.62 см) - 1366x768, матов",
                                   new Battery(BatteryType.NiCad, 3, 2550),
                                   4.5,
                                   819
                                   );

        Laptop laptop2 = new Laptop();



        Console.WriteLine(laptop);
        Console.WriteLine(laptop2);
    }
예제 #45
0
        public ActionResult Delete(int id)
        {
            var us = db.Registrations.Where(c => c.Email == User.Identity.Name).FirstOrDefault();

            try
            {
                if (us.Role == "Admin")
                {
                    Laptop lap = db.Laptops.Find(id);
                    if (lap != null)
                    {
                        return(View(lap));
                    }
                }
                return(RedirectToAction("Laptopy"));
            }
            catch
            {
                return(RedirectToAction("Laptopy"));
            }
        }
예제 #46
0
        public ActionResult Edit(int id)
        {
            var us = db.Registrations.Where(c => c.Email == User.Identity.Name).FirstOrDefault();

            try
            {
                if (us.Role == "Admin")
                {
                    Laptop laptop = db.Laptops.Where(c => c.LaptopId == id).FirstOrDefault();
                    if (laptop != null)
                    {
                        return(View("~/Views/Laptop/Edit.cshtml", db.Laptops.Where(c => c.LaptopId == id).FirstOrDefault())); //return edit view
                    }
                }
                return(RedirectToAction("Laptopy"));
            }
            catch
            {
                return(RedirectToAction("Laptopy"));
            }
        }
예제 #47
0
        public string AddComputer(string computerType, int id, string manufacturer, string model, decimal price) //DON'T CHECK IF COMPUTER WITH ID EXISTS
        {
            IComputer computer = null;

            if (computerType == "DesktopComputer")
            {
                computer = new DesktopComputer(id, manufacturer, model, price);
            }
            else if (computerType == "Laptop")
            {
                computer = new Laptop(id, manufacturer, model, price);
            }
            else
            {
                throw new ArgumentException("Computer type is invalid.");
            }

            computers.Add(computer);

            return($"Computer with id {id} added successfully.");
        }
예제 #48
0
        public SmartHomeData()
        {
            _laptop = new Laptop
            {
                Id          = "laptop",
                Name        = "HP Envy-17",
                Description = "Personal computer",
                State       = LaptopState.On,
                Music       = "Radistai - Coming Home"
            };

            _lights = new Lights
            {
                Id          = "lights",
                Name        = "LEDs Strip",
                Description = "5M RGB 5050 300LEDs Waterproof Strip Light",
                State       = LightsState.On,
                Mode        = LightsMode.Static,
                RGB         = "255,255,255"
            };
        }
예제 #49
0
        public void GetLaptopFromDatabase()
        {
            TestLaptopProvider laptopProvider = new TestLaptopProvider(mockLaptopContext.Object);
            Laptop             laptop         = new Laptop()
            {
                model    = "12311",
                code     = 1235,
                DiscSize = 1,
                price    = 100,
                ram      = 1,
                screen   = 1,
                speed    = 1
            };

            laptops.Add(laptop);

            var result = laptopProvider.GetLaptop(1235);

            Assert.NotNull(result);
            Assert.AreEqual(result, laptop);
        }
예제 #50
0
        public string AddComputer(string computerType, int id, string manufacturer, string model, decimal price)
        {
            if (this.computers.Any(x => x.Id == id))
            {
                throw new ArgumentException(ExceptionMessages.ExistingComputerId);
            }

            IComputer computer = null;

            switch (computerType)
            {
            case "DesktopComputer": computer = new DesktopComputer(id, manufacturer, model, price); break;

            case "Laptop": computer = new Laptop(id, manufacturer, model, price); break;

            default: throw new ArgumentException(ExceptionMessages.InvalidComputerType);
            }

            this.computers.Add(computer);
            return(string.Format(SuccessMessages.AddedComputer, id));
        }
예제 #51
0
        public override Laptop MakeLaptop()
        {
            var ram         = new RandomAcessMemory(LaptopRam);
            var videoCard   = new VideoCard(LaptopMonochromeVideoCard);
            var motherBoard = new Motherboard(ram, videoCard);
            var cpu         = new CentralProcessingUnit(LaptopNumberOfCores, LaptopBits, motherBoard);
            var hardDrive   = new HardDriver(LaptopHardDriveCapacity, false, 0);
            var battery     = new LaptopBattery();

            var dellLaptop = new Laptop(
                cpu,
                ram,
                new List <HardDriver> {
                hardDrive
            },
                videoCard,
                motherBoard,
                battery);

            return(dellLaptop);
        }
예제 #52
0
        static void DisplayStatus(Laptop laptop)
        {
            Console.Clear();
            Console.WriteLine($"Title:              {laptop.Title}");
            Console.WriteLine($"Device status:      {(laptop.IsEnabled ? "ON" : "OFF")}");
            Console.WriteLine($"OS status:          {(laptop.OperatingSystem.IsEnabled ? "ON" : "OFF")}");
            Console.WriteLine($"CPU status:         {(laptop.CPU.IsEnabled ? "ENABLED" : "DISABLED")}");
            Console.WriteLine($"Battery charge:     {laptop.Battery.CurrentCharge} mAh");
            Console.WriteLine($"RAM used space:     {laptop.RAM.UsedSpace} GB");
            Console.WriteLine($"SSD used space:     {laptop.ExternalStorage.UsedSpace} GB");
            Console.WriteLine($"Network status:     {(laptop.HasNetworkConnection ? "CONNECTED" : "DISCONNECTED")}");
            Console.WriteLine($"Electricity status: {(laptop.HasElectricityConnection ? "CONNECTED" : "DISCONNECTED")}");
            Console.WriteLine("Installed programs:");
            int i = 9;

            foreach (DOS.Program program in laptop.OperatingSystem.Programs)
            {
                Console.SetCursorPosition(20, i++);
                Console.Write($"{program.Title}: {(program.IsEnabled ? "ON" : "OFF")}");
            }
        }
예제 #53
0
        static Laptop CreateLaptop()
        {
            Battery battery = Config.GetBatteries().ElementAt(SelectComponent("Select Battery:", Config.GetBatteries()));
            CPU     cpu     = Config.GetCPUs().ElementAt(SelectComponent("Select CPU:", Config.GetCPUs()));
            RAM     ram     = Config.GetRAMs().ElementAt(SelectComponent("Select RAM:", Config.GetRAMs()));
            SSD     ssd     = Config.GetSSDs().ElementAt(SelectComponent("Select SSD:", Config.GetSSDs()));

            DOS.OperatingSystem os = Config.GetOperatingSystems().ElementAt(SelectComponent("Select OS:", Config.GetOperatingSystems()));

            bool electricity = SelectFlag("Will new laptop have an electricity connection?[y / n]: ");
            bool network     = SelectFlag("Will new laptop have an network connection?[y / n]: ");

            Console.Write("Name of laptop: ");
            Laptop laptop = new Laptop(Console.ReadLine(), cpu, battery, ram, ssd, os, electricity, network);

            foreach (DOS.Program program in Config.GetPrograms())
            {
                laptop.OperatingSystem.Install(program);
            }
            return(laptop);
        }
예제 #54
0
        private Laptop GetEntity()
        {
            //int NivelAcceso = Convert.ToInt32(rbNivelAcceso.SelectedValue);
            Laptop objLaptop = new Laptop();

            objLaptop.Serie                 = txtSerie.Text;
            objLaptop.Marca                 = txtMarca.Text;
            objLaptop.Modelo                = txtModelo.Text;
            objLaptop.Ram                   = txtRam.Text;
            objLaptop.NombreLaptop          = txtNombreEquipo.Text;
            objLaptop.Procesador            = txtProcesador.Text;
            objLaptop.MAC                   = txtMac.Text;
            objLaptop.IDTeamviewer          = Convert.ToInt32(txtTeamViewerID.Text);
            objLaptop.FechaCompra           = Convert.ToDateTime(txtFechaCompra.Text);
            objLaptop.FechaEntrega          = Convert.ToDateTime(txtFechaEntrega.Text);
            objLaptop.FechaUltimaMantencion = Convert.ToDateTime(txtFechaMantencion.Text);
            objLaptop.Estado                = txtEstado.Text;
            objLaptop.Opcional              = txtOpcional.Text;
            objLaptop.Comentario            = txtComentario.Text;
            objLaptop.SistOperativo         = txtSO.Text;
            objLaptop.HDD                   = Convert.ToInt32(txtHDD.Text);

            /**
             * if (NivelAcceso == 1)
             * {
             *  objUsuario.Cliente = "TODOS";
             *  objUsuario.Contrato = "TODOS";
             * }
             * if (NivelAcceso == 2)
             * {
             *  objUsuario.Cliente = ddlAcceso.SelectedItem.Text;
             *  objUsuario.Contrato = "0";
             * }
             * if (NivelAcceso == 3)
             * {
             *  objUsuario.Cliente = "0";
             *  objUsuario.Contrato = ddlAcceso.SelectedItem.Text;
             * }**/
            return(objLaptop);
        }
예제 #55
0
        public void PostEndPointWithXmlData()
        {
            int    id      = random.Next(1000);
            string xmlData = "<Laptop>" +
                             "<BrandName>Lenovo</BrandName>" +
                             "<Features>" +
                             "<Feature>3th Generation Intel® Core™ i2 - 8300H </Feature>" +
                             "<Feature> Windows 4 Home 64 - bit English </Feature>" +
                             "<Feature> NVIDIA® GeForce® GTX 1260 Ti 1GB GDDR6</ Feature>" +
                             "< Feature  1GB, 4GB, DDR4, 2000MHz </Feature>" +
                             "</Features>" +
                             "< Id>" + id + "</Id>" +
                             "<LaptopName> Len P89</LaptopName>" +
                             "</Laptop> ";

            using (HttpClient httpClient = new HttpClient())
            {
                httpClient.DefaultRequestHeaders.Add("Accept", XmlMediaType);
                HttpContent httpContent = new StringContent(xmlData, Encoding.UTF8, XmlMediaType);
                Task <HttpResponseMessage> postResponse = httpClient.PostAsync(POSTURL, httpContent);
                //HttpStatusCode statusCode = postResponse.Result.StatusCode;
                //HttpContent responseContent = postResponse.Result.Content;
                //string responseData = responseContent.ReadAsStringAsync().Result;
                //restResponse = new RestResponse((int)statusCode, responseData);
                //Assert.AreEqual(200, restResponse.StatusCode);
                // Assert.IsNotNull(restResponse.ResponseContent, "Response data is null/empty");

                postResponse = httpClient.GetAsync(GETURL + id);
                if (!postResponse.Result.IsSuccessStatusCode)
                {
                    Assert.Fail();
                }
                restResponseForGet = new RestResponse((int)postResponse.Result.StatusCode,
                                                      postResponse.Result.Content.ReadAsStringAsync().Result);
                XmlSerializer xmlSerializer = new XmlSerializer(typeof(Laptop));
                TextReader    textReader    = new StringReader(restResponse.ResponseContent);
                Laptop        xmlObject     = (Laptop)xmlSerializer.Deserialize(textReader);
                Assert.IsTrue(xmlObject.Features.Feature.Contains("3th Generation Intel® Core™ i2 - 8300H"), "Item not found");
            }
        }
예제 #56
0
        public ActionResult Edit(int id, FormCollection collection)
        {
            var us = db.Registrations.Where(c => c.Email == User.Identity.Name).FirstOrDefault();

            try
            {
                if (us.Role == "Admin")
                {
                    Laptop lap = db.Laptops.Where(x => x.LaptopId == id).FirstOrDefault();
                    if (lap != null)
                    {
                        var laptop = lap;

                        laptop.Nazwa          = Convert.ToString(collection["Nazwa"]);
                        laptop.Cena           = Int32.Parse(Convert.ToString(collection["Cena"]));
                        laptop.Marka          = Convert.ToString(collection["Marka"]);
                        laptop.Opis           = Convert.ToString(collection["Opis"]);
                        laptop.Rozdzielczosc  = Convert.ToString(collection["Rozdzielczosc"]);
                        laptop.Przekatna      = Int32.Parse(Convert.ToString(collection["Przekatna"]));
                        laptop.SeriaProcesora = Convert.ToString(collection["SeriaProcesora"]);
                        laptop.IloscRdzeni    = Int32.Parse(Convert.ToString(collection["iloscRdzeni"]));
                        laptop.RAM            = Int32.Parse(Convert.ToString(collection["RAM"]));
                        laptop.PamiecGrafika  = Int32.Parse(Convert.ToString(collection["PamiecGrafika"]));
                        laptop.Stan           = Convert.ToString(collection["Stan"]);
                        laptop.System         = Convert.ToString(collection["System"]);
                        laptop.Zlacza         = Convert.ToString(collection["Zlacza"]);
                        laptop.Sprzedany      = Boolean.Parse(collection["Sprzedany"]);
                        laptop.Kategoria      = "Laptopy";

                        db.Entry(laptop).State = EntityState.Modified;
                        db.SaveChanges();
                    }
                }
                return(RedirectToAction("Laptopy"));
            }
            catch
            {
                return(View());
            }
        }
예제 #57
0
        public List <Laptop> GetAllLaptops()
        {
            List <Laptop> results   = new List <Laptop>();
            string        cmdString = "SELECT * FROM Laptop";


            using (SqlConnection connection = new SqlConnection(ConnString))
            {
                using (SqlCommand cmd = new SqlCommand(cmdString, connection))
                {
                    connection.Open();
                    using (SqlDataReader reader = cmd.ExecuteReader())
                    {
                        if (reader.HasRows)
                        {
                            while (reader.Read())
                            {
                                string id         = reader.GetString(0);
                                string serial     = reader.GetString(1);
                                int    devicetype = reader.GetInt32(2);
                                string brand      = reader.GetString(3);
                                string model      = reader.GetString(4);
                                string processor  = reader.GetString(5);
                                string ram        = reader.GetString(6);
                                string reso       = reader.GetString(7);
                                string size       = reader.GetString(8);
                                long   dateadded  = long.Parse(reader.GetString(9));
                                string mem        = reader.GetString(10);
                                int    OS         = reader.GetInt32(11);

                                Laptop l = new Laptop(id, serial, (Laptop.DeviceTypes)devicetype, brand, model, processor, ram, reso, size, new DateTime(dateadded), true, mem, (Laptop.OperatingSystems)OS);
                                results.Add(l);
                            }
                        }
                    }
                }
            }

            return(results);
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void bgwAwaitBroadcasts_DoWork(object sender, DoWorkEventArgs e)
        {
            NetworkStream broadcastStream;

            byte[] inStream = new byte[10025];
            while (true)
            {
                try {
                    broadcastStream = ClientSocket.GetStream();
                    broadcastStream.Read(inStream, 0, ClientSocket.ReceiveBufferSize);
                    var streamIdentifier = (DataIdentifier)BitConverter.ToInt32(inStream, 0);
                    if (streamIdentifier == DataIdentifier.Broadcast)
                    {
                        List <string> broadcast = DeserializeStringStream(inStream);
                        foreach (string s in broadcast)
                        {
                            //UpdateStatus(s);
                        }
                    }
                    else if (streamIdentifier == DataIdentifier.Laptop)
                    {
                        SplitAndAddPCStream(inStream);
                        bgwAwaitBroadcasts.ReportProgress(0);
                    }
                    else if (streamIdentifier == DataIdentifier.Update)
                    {
                        Laptop updatedPC = new Laptop(inStream.Skip(4).ToArray());
                        UpdateLaptop(updatedPC);
                        bgwAwaitBroadcasts.ReportProgress(0);
                    }
                    else if (streamIdentifier == DataIdentifier.Null)
                    {
                    }
                } catch /*(Exception ex)*/ {
                    //UpdateStatus(ex.Message);
                    //TODO: add a prompt for the user to reconnect to the server.
                    break;
                }
            }
        }
예제 #59
0
        public void CreatingLaptopWithValidDataShouldSetAllPropertiesCorrectly()
        {
            var laptop = new Laptop(
                "VN7-591G",                // Model
                "Acer Aspire",             // Manufacturer
                "Intel Core i7-4710HQ",    // Processor
                "NVIDIA GeForce GTX 860M", // Graphics card
                "8 cells",                 // Battery
                4,                         // Battery life in hours
                15.6,                      // Screen size
                1959                       // Price in leva
                );

            Assert.AreEqual("Acer Aspire", laptop.Manufacturer, "Manufacturer name is set wrong");
            Assert.AreEqual("VN7-591G", laptop.Model, "Model name is set wrong");
            Assert.AreEqual("Intel Core i7-4710HQ", laptop.Processor, "Processor name is set wrong");
            Assert.AreEqual("NVIDIA GeForce GTX 860M", laptop.GraphicsCard, "Graphics card name is set wrong");
            Assert.AreEqual("8 cells", laptop.Battery.Description, "Battery description is set wrong");
            Assert.AreEqual(4, laptop.Battery.LifeInHours, "Battery life in hours description is set wrong");
            Assert.AreEqual(15.6, laptop.ScreenSize, "Screen size is set wrong");
            Assert.AreEqual(1959, laptop.Price, "Price is set wrong");
        }
예제 #60
0
    private static void Main()
    {
        Laptop LenovoY50 = new Laptop(
            model: "Lenovo Y50",
            manufacturer: "Lenovo",
            price: 2665.0m,
            processor: "Intel Core i7-4710MQ (4-ядрен, 2.50 - 3.50 GHz, 6MB кеш)",
            ram: "8 GD",
            graphicsCard: "NVIDIA GeForce GTX 860M (4GB GDDR5, GM107)",
            hdd: "128GB SSD", screen: "15.6-инчов (39.62 см.) - 1920x1080 (Full HD), матов",
            battery: new Battery(lifeInHours: 4.5f, description: "6-клетъчна")
            );

        Laptop LenovoYoga2Pro = new Laptop(
            model: "Lenovo Yoga 2 Pro",
            price: 699.00m
            );

        Console.WriteLine(LenovoY50);
        Console.WriteLine();
        Console.WriteLine(LenovoYoga2Pro);
    }