示例#1
0
        public void TestRange()
        {
            int a = 1;
            int b = 10;
            Cpu cpu = new Cpu(2, 64);
            bool wasOutOfRange = false;
            for (int i = 0; i < 10; i++)
            {
                int rnd = cpu.GenerateRndInteger(a, b);
                if (rnd < a || rnd > b)
                {
                    wasOutOfRange = true;
                }
            }

            Assert.AreEqual(false, wasOutOfRange);
        }
示例#2
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);
        }
示例#3
0
        public void TestForNotGettingTheSameNumber()
        {
            int a = 1;
            int b = 10;
            Cpu cpu = new Cpu(2, 128);
            int counter = 0;
            int currNumber = int.MinValue;
            for (int i = 0; i < 3; i++)
            {
                int rnd = cpu.GenerateRndInteger(a, b);
                if (rnd == currNumber)
                {
                    counter++;
                }
            }
            bool equality = false;
            if (counter == 2)
            {
                equality = true;
            }

            Assert.AreEqual(false, equality);
        }