public void ChargeShouldNotAddToPercentageWhenPositiveNumberIsGivenAndCurrentPercentageIsHundered()
 {
     var battery = new LaptopBattery();
     battery.Percentage = LaptopBattery.MaxBatteryPercentage;
     battery.Charge(10);
     Assert.AreEqual(LaptopBattery.MaxBatteryPercentage, battery.Percentage);
 }
        public void Method3()
        {
            LaptopBattery b = new LaptopBattery();

            b.Charge(-2000);
            Assert.AreEqual(00, b.Percentage);
        }
        public void Method4()
        {
            LaptopBattery b = new LaptopBattery();

            b.Charge(0);
            Assert.AreEqual(50, b.Percentage);
        }
 public void ChargeShouldNotAddToPercentageOrSubstractFromItWhenZeroIsGiven()
 {
     var battery = new LaptopBattery();
     battery.Percentage = LaptopBattery.DefaultBatteryPercentage;
     battery.Charge(0);
     Assert.AreEqual(LaptopBattery.DefaultBatteryPercentage, battery.Percentage);
 }
 public void ChargeShouldNotSubstractFromPercentageWhenNegativeNumberIsGivenAndCurrentPercentageIsZero()
 {
     var battery = new LaptopBattery();
     battery.Percentage = LaptopBattery.MinBatteryPercentage;
     battery.Charge(-10);
     Assert.AreEqual(LaptopBattery.MinBatteryPercentage, battery.Percentage);
 }
            internal Computer(Computers.Type type,
                              Cpu cpu,

                              Rammstein
                              ram,
                              IEnumerable <HardDriver> hardDrives,
                              HardDriver videoCard,
                              LaptopBattery battery)
            {
                Cpu        = cpu;
                Ram        = ram;
                HardDrives = hardDrives;
                VideoCard  =

                    videoCard;
                if (type !=
                    Type.LAPTOP &&
                    type
                    !=
                    Type.PC)
                {
                    VideoCard.IsMonochrome = true;
                }
                this.battery = battery;
            }
 public void ChargeShouldAddToPercentageWhenPositiveNumberIsGiven()
 {
     var battery = new LaptopBattery();
     battery.Percentage = LaptopBattery.DefaultBatteryPercentage;
     battery.Charge(10);
     Assert.AreEqual(60, battery.Percentage);
 }
        public void Charging50PercentBatteryWithMinus60ShouldChargeTHeBatteryTo0Percent()
        {
            var battery = new LaptopBattery();

            battery.Charge(-60);
            Assert.AreEqual(0, battery.Percentage);
        }
Esempio n. 9
0
 public Laptop(IMotherboard motherboard, Cpu cpu, HardDriveComponent hardDrive, LaptopBattery laptopBattery)
 {
     this.Motherboard = motherboard;
     this.Cpu = cpu;
     this.HardDrive = hardDrive;
     this.LaptopBattery = laptopBattery;
 }
Esempio n. 10
0
        public void CreateBatteryInitiallyShouldReturn50Percents()
        {
            var laptopBattery      = new LaptopBattery();
            var exceptedPercentage = 50;

            Assert.AreEqual(exceptedPercentage, laptopBattery.Percentage);
        }
 public void ChargeShouldSubstractFromPercentageWhenNegativeNumberIsGiven()
 {
     var battery = new LaptopBattery();
     battery.Percentage = LaptopBattery.DefaultBatteryPercentage;
     battery.Charge(-10);
     Assert.AreEqual(40, battery.Percentage);
 }
        public void Charging50PercentBatteryWith10ShouldChargeTHeBatteryTo60Percent()
        {
            var battery = new LaptopBattery();

            battery.Charge(10);
            Assert.AreEqual(60, battery.Percentage);
        }
        public void ChargeShouldNotAddToPercentageWhenGivenPositiveNumberAndCurrentPercentageIs100()
        {
            var battery = new LaptopBattery();

            battery.Percentage = LaptopBattery.MaxBatteryPercentage;
            battery.Charge(10);
            Assert.AreEqual(LaptopBattery.MaxBatteryPercentage, battery.Percentage);
        }
        public void ChargeShouldAddToPercentageWhenGivenPositiveNumber()
        {
            var battery = new LaptopBattery();

            battery.Percentage = 50;
            battery.Charge(10);
            Assert.AreEqual(60, battery.Percentage);
        }
        public void TestCharge_PassLowerValues_ShouldSetBatteryPercentageZero(int lowerPercentage)
        {
            var battery = new LaptopBattery();

            battery.Charge(lowerPercentage);

            Assert.AreEqual(battery.PercentagePowerLeft, 0);
        }
        public void ChargeShouldNotSubstractFromPercentageWhenGivenZero()
        {
            var battery = new LaptopBattery();

            battery.Percentage = 50;
            battery.Charge(0);
            Assert.AreEqual(50, battery.Percentage);
        }
        public void ChargeShouldSubstractFromPercentageWhenGivenNegativeNumber()
        {
            var battery = new LaptopBattery();

            battery.Percentage = 50;
            battery.Charge(-10);
            Assert.AreEqual(40, battery.Percentage);
        }
        public void ChargeShouldNotGoAboveOneHundred()
        {
            var battery = new LaptopBattery();

            battery.Percentage = 50;
            battery.Charge(80);
            Assert.AreEqual(100, battery.Percentage);
        }
        public void ChargeShouldNotSubstractFromPercentageWhenGivenNegativeNumberAndCurrentPercentageIsZero()
        {
            var battery = new LaptopBattery();

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

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

            battery.Percentage = 50;
            battery.Charge(0);
            Assert.AreEqual(50, battery.Percentage);
        }
        public void TestCharge_PassHigherValues_ShouldSetBatteryPercentageHundred(int higherPercentage)
        {
            var battery = new LaptopBattery();

            battery.Charge(higherPercentage);

            Assert.AreEqual(battery.PercentagePowerLeft, 100);
        }
Esempio n. 23
0
        public void Should_ChargeTo50AtFirstInitialisation()
        {
            // Arrange
            LaptopBattery battery       = new LaptopBattery();
            int           initialCharge = 50;

            // Act && Assert
            Assert.AreEqual(initialCharge, battery.Percentage);
        }
Esempio n. 24
0
        public void TestOnNegativeInputValueShouldReturnZero()
        {
            var laptopBattery = new LaptopBattery();

            laptopBattery.Charge(-1000);
            var exceptedPercentage = 0;

            Assert.AreEqual(exceptedPercentage, laptopBattery.Percentage);
        }
Esempio n. 25
0
        public void ChargeBattary_WhenValidPossitiveIntegerIsPassed(int chargePercentage, int expected)
        {
            var battary = new LaptopBattery();

            battary.Charge(chargePercentage);
            var actual = battary.Percentage;

            Assert.AreEqual(expected, actual);
        }
Esempio n. 26
0
        public void TestOnInputValueGreaterThanMaximalValueShouldReturn100()
        {
            var laptopBattery = new LaptopBattery();

            laptopBattery.Charge(10000);
            var exceptedPercentage = 100;

            Assert.AreEqual(exceptedPercentage, laptopBattery.Percentage);
        }
Esempio n. 27
0
        public void Add50PercentsShouldReturn100()
        {
            var laptopBattery = new LaptopBattery();

            laptopBattery.Charge(50);
            var exceptedPercentage = 100;

            Assert.AreEqual(exceptedPercentage, laptopBattery.Percentage);
        }
Esempio n. 28
0
        public void Subtract50PercentsShouldReturnZero()
        {
            var laptopBattery = new LaptopBattery();

            laptopBattery.Charge(-50);
            var exceptedPercentage = 0;

            Assert.AreEqual(exceptedPercentage, laptopBattery.Percentage);
        }
        public void TestCharge_PassValuesInRange_ShouldSetBatteryPercentageCorrectly(int percentage)
        {
            var battery           = new LaptopBattery();
            var currentPercentage = battery.PercentagePowerLeft;

            battery.Charge(percentage);
            var expected = percentage + currentPercentage;

            Assert.AreEqual(battery.PercentagePowerLeft, expected);
        }
Esempio n. 30
0
        public void ChargeBattary_WhenValidPossitiveIntegerIsPassed()
        {
            var battary = new LaptopBattery();

            battary.Charge(10);
            var actual   = battary.Percentage;
            var expected = 60;

            NUnit.Framework.Assert.AreEqual(expected, actual);
        }
Esempio n. 31
0
 internal Laptop(
     Cpu cpu,
     Ram ram,
     IEnumerable <IHardDrive> hardDrives,
     IVideoCard videoCard,
     LaptopBattery battery)
     : base(cpu, ram, hardDrives, videoCard)
 {
     this.battery = battery;
 }
Esempio n. 32
0
        public override Computer MakeLaptop()
        {
            var videoCard = new ColorVideoCard();
            var ramMemory = new RAMMemory(4);
            var cpu = new Cpu(2, 64);
            var hdd = new[] { new HardDriver(500, false, 0) };
            var battery = new LaptopBattery();
            var laptop = new Computer("LAPTOP", cpu, ramMemory, hdd, videoCard, new LaptopBattery());

            return laptop;
        }
Esempio n. 33
0
        public Laptop CreateLaptop()
        {
            var ram = new Ram(4);
            var videoCard = new VideoCard(false);
            var cpu = new Cpu(4, 32, ram, videoCard);
            var storage = new HardDrive(1000);
            var battery = new LaptopBattery();
            var laptop = new Laptop(cpu, ram, storage, videoCard, battery);

            return laptop;
        }
Esempio n. 34
0
        public ILaptop GetLaptop()
        {
            var cpu = new CPU(LaptopCpuCores, LaptopCpuBits);
            var ram = new RAM(LaptopRam);
            var hardDrive = new HardDrive(LaptopHardDriveCapacity, false);
            var videoCard = new VideoCard(false);
            var battery = new LaptopBattery();
            var hardDrives = new List<HardDrive>();
            hardDrives.Add(hardDrive);

            return new Laptop(cpu, ram, hardDrives, videoCard, battery);
        }
Esempio n. 35
0
        public override Laptop CreateLaptop()
        {
            var ram = new Ram((int)RamType.GB16);
            var videoCard = new VideoCard(false);
            var motherBoard = new Motherboard(ram, videoCard);
            var cpu = new AdvancedCpu(2, (int)ArchitectureType.Bits64, motherBoard);
            var hardDrive = new HardDrive(1000);
            var laptopBattery = new LaptopBattery();
            var laptop = new Laptop(motherBoard, cpu, hardDrive, laptopBattery);

            return laptop;
        }
Esempio n. 36
0
        public void Should_DischargeBatteryWithSpecifiedPowerCharge()
        {
            // Arrange
            LaptopBattery battery         = new LaptopBattery();
            int           initialCharge   = battery.Percentage;
            int           newChargeAmount = -10;

            // Act
            battery.Charge(newChargeAmount);

            // Assert
            Assert.AreEqual(initialCharge + newChargeAmount, battery.Percentage);
        }
Esempio n. 37
0
        public void Should_NotDischargeLessThanZero()
        {
            // Arrange
            LaptopBattery battery         = new LaptopBattery();
            int           initialCharge   = battery.Percentage;
            int           newChargeAmount = -150;
            int           minimumCharge   = 0;

            // Act
            battery.Charge(newChargeAmount);

            // Assert
            Assert.AreEqual(minimumCharge, battery.Percentage);
        }
Esempio n. 38
0
 public override ILaptopComputer MakeLaptopComputer()
 {
     IVideoCard videoCard = new ColorVideoCard();
     Ram ram = new Ram(8);
     IMotherboard motherboard = new Motherboard(ram, videoCard);
     Cpu cpu = new Cpu32Bit(4, motherboard, this.random);
     var hardDrive = new[]
     {
         new HardDrive(1000, false, 0)
     };
     LaptopBattery battery = new LaptopBattery();
     ILaptopComputer laptop = new LaptopComputer(motherboard, cpu, ram, hardDrive, videoCard, battery);
     return laptop;
 }
Esempio n. 39
0
        public void Should_NotChargeMoreThan100()
        {
            // Arrange
            LaptopBattery battery         = new LaptopBattery();
            int           initialCharge   = battery.Percentage;
            int           newChargeAmount = 150;
            int           maximumCharge   = 100;

            // Act
            battery.Charge(newChargeAmount);

            // Assert
            Assert.AreEqual(maximumCharge, battery.Percentage);
        }
Esempio n. 40
0
        internal Computer(
            string type,
            Cpu cpu,
            RAMMemory ram,
            IEnumerable<HardDriver> hardDrives,
            IVideoCard videoCard,
            LaptopBattery battery)
        {
            this.type = type;
            this.Cpu = cpu;
            this.Ram = ram;
            this.HardDrives = hardDrives;
            this.VideoCard = videoCard;

            this.battery = battery;
            this.motherBoard = new MotherBoard(this.Cpu, this.Ram, this.VideoCard);
        }
Esempio n. 41
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;
        }
Esempio n. 42
0
        internal Computer(ComputerType type,
            Cpu cpu,
            Rammstein ram,
            IEnumerable<HardDriver> hardDrives,
            HardDriver videoCard,
            LaptopBattery battery)
        {
            Cpu = cpu;
            Ram = ram;
            HardDrives = hardDrives;
            VideoCard = videoCard;

            if (type != ComputerType.LAPTOP && type != ComputerType.PC)
            {
                VideoCard.IsMonochrome = true;
            }
            this.battery = battery;
        }
Esempio n. 43
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);
        }
Esempio n. 44
0
        public Computer CreateServer(int cpuType, int coreCount, int ramSize, int hardCount, int hardCapacity)
        {
            IRAM ram = new RAM(ramSize);
            ICPU cpu;

            switch (cpuType)
            {
            case 32:
                cpu = new CPU32(ram, coreCount);
                break;

            case 64:
                cpu = new CPU64(ram, coreCount);
                break;

            case 128:
                cpu = new CPU128(ram, coreCount);
                break;

            default:
                break;
            }
            IVideoCard   videoCard     = new MonochromeVideoCard();
            IMotherboard motherBoard   = new MotherBoard();
            RAID         hardDriveRaid = new RAID();
            IBattery     battery       = new LaptopBattery();

            for (int i = 0; i < hardCount; i++)
            {
                HardDrive currentHardDrive = new HardDrive(hardCapacity, true);
                hardDriveRaid.AddHardDrive(currentHardDrive);
            }
            Computer server = new Server(cpu, ram, videoCard, hardDriveRaid, motherBoard);

            return(server);
        }
Esempio n. 45
0
 public Laptop(Cpu cpu, BaseHardDrive hardDrives, RAM ram, IDrawable videoCard, LaptopBattery battery)
     : base(cpu, hardDrives, ram, videoCard)
 {
     this.battery = battery;
 }
Esempio n. 46
0
 public Laptop(LaptopBattery battery, CPU cpu, RAM ram, HardDriver hardDriver, IDrawable videoCard)
     : base(cpu, ram, hardDriver, videoCard)
 {
     this.Battery = battery;
 }
Esempio n. 47
0
 public void TestInitialize()
 {
     this.battery = new LaptopBattery();
 }
 public void InitializeBattery()
 {
     this.battery = new LaptopBattery();
 }
Esempio n. 49
0
 public Laptop(CentralProcessingUnit cpu, RandomAcessMemory ram, IEnumerable<HardDriver> hardDrives, IVideoCard videoCard, IMotherboard motherBoard, LaptopBattery battery)
     : base(cpu, ram, hardDrives, videoCard, motherBoard)
 {
     this.LaptopBattery = battery;
 }
Esempio n. 50
0
 public Laptop(Cpu cpu, Ram ram, IStorageDevice hardDrives, VideoCard videoCard, LaptopBattery battery)
     : base(cpu, ram, hardDrives, videoCard)
 {
     this.battery = battery;
 }
Esempio n. 51
0
 public Laptop(CPU cpu, RAM ram, IEnumerable<HardDrive> hardDrives, VideoCard videoCard, LaptopBattery battery)
     : base(cpu, ram, hardDrives, videoCard)
 {
     this.Battery = battery;
 }
 public void Method3()
 {
     LaptopBattery b = new LaptopBattery();
     b.Charge(-2000);
     Assert.AreEqual(00, b.Percentage);
 }
 public void Method4()
 {
     LaptopBattery b = new LaptopBattery();
     b.Charge(0);
     Assert.AreEqual(50, b.Percentage);
 }
Esempio n. 54
0
 public void TestFullUnload()
 {
     LaptopBattery battery = new LaptopBattery();
     battery.Charge(-50);
     Assert.AreEqual(0, battery.Percentage);
 }
 public void Initial()
 {
     LaptopBattery b = new LaptopBattery();
     Assert.AreEqual(50, b.Percentage);
 }
Esempio n. 56
0
 public void TestForNegativValue()
 {
     LaptopBattery battery = new LaptopBattery();
     battery.Charge(-51);
     Assert.AreEqual(0, battery.Percentage);
 }
Esempio n. 57
0
 public void TestForMaxCharge()
 {
     LaptopBattery battery = new LaptopBattery();
     battery.Charge(50);
     Assert.AreEqual(100, battery.Percentage);
 }
Esempio n. 58
0
 public void TestForUpLimitValue()
 {
     LaptopBattery battery = new LaptopBattery();
     battery.Charge(51);
     Assert.AreEqual(100, battery.Percentage);
 }
Esempio n. 59
0
 public void TestWithZe0rCharge()
 {
     LaptopBattery battery = new LaptopBattery();
     battery.Charge(0);
     Assert.AreEqual(50, battery.Percentage);
 }
Esempio n. 60
0
 public void TestinitialCharge()
 {
     LaptopBattery battery = new LaptopBattery();
     Assert.AreEqual(50, battery.Percentage);
 }