public void ChargeShouldNotGoAbove100()
        {
            var battery = new LaptopBattery();
            battery.Charge(51);

            Assert.AreEqual(100, battery.Percentage);
        }
        public void ChargeShouldNotGoBelowZero()
        {
            var battery = new LaptopBattery();
            battery.Charge(-51);

            Assert.AreEqual(0, battery.Percentage);
        }
        public void ChargeWorksCorrectWithNegativeValues()
        {
            var battery = new LaptopBattery();
            battery.Charge(-1);

            Assert.AreEqual(49, battery.Percentage);
        }
 public ComputerServer(
     Cpu cpu,
     Ram ram,
     IEnumerable<HardDrive> hardDrives,
     HardDrive hardDrive,
     LaptopBattery battery,
     Videocard videocard)
     : base(cpu, ram, hardDrives, hardDrive, battery, videocard)
 {
 }
示例#5
0
 internal Computer(
     Cpu cpu,
     IRam ram,
     IEnumerable<HardDrive> hardDrives,
     IHardDrive hardDrive,
     LaptopBattery battery,
     IVideocard videocard)
 {
     this.cpu = cpu;
     this.ram = ram;
     this.hardDrives = hardDrives;
     this.hardDrive = hardDrive;
     this.videocard = videocard;
     this.battery = battery;
 }
        public void InitialChargeMustBe50()
        {
            var battery = new LaptopBattery();

            Assert.AreEqual(50, battery.Percentage);
        }