Пример #1
0
        public void TestAttach()
        {
            Rover myRover = new Rover();
            Radar myRadar = new Radar();
            myRover.AttachDevice(myRadar);

            Assert.IsTrue (myRover.DeviceCount == 1);
        }
Пример #2
0
 public void TestDrillNoSafety()
 {
     Rover myRover = new Rover ();
     Drill myDrill = new Drill ();
     Battery bat1 = new Battery (50);
     myRover.AddBattery (bat1);
     myRover.AttachDevice(myDrill);
     Assert.IsTrue(myDrill.Battery.Charge == 50);
     Assert.IsTrue(myDrill.Connected == true);
     myDrill.Operate ();
     Assert.IsTrue(myDrill.Battery.Charge == 40);
 }
Пример #3
0
        public void TestConnect()
        {
            Rover myRover = new Rover();
            Radar myRadar = new Radar();
            myRover.AttachDevice(myRadar);
            Battery bat1 = new Battery (60);
            Assert.IsTrue(myRadar.Connected == false);

            myRover.AddBattery (bat1);
            myRadar.AddBatery (bat1);
            Assert.IsTrue(myRadar.Connected == true);
        }
Пример #4
0
        public void TestConnectToHighestCharge()
        {
            Rover myRover = new Rover();
            Radar myRadar = new Radar();
            Battery bat1 = new Battery (50);
            Battery bat2 = new Battery (55);
            Battery bat3 = new Battery (60);
            myRover.AddBattery (bat1);
            myRover.AddBattery (bat2);
            myRover.AddBattery (bat3);

            myRover.AttachDevice(myRadar);

            Assert.IsTrue(myRadar.Battery.Charge == 60);
        }
Пример #5
0
        public void TestConnectedOnAttach()
        {
            Rover myRover = new Rover();
            Radar myRadar = new Radar();
            Battery bat1 = new Battery (50);
            Battery bat2 = new Battery (55);
            Battery bat3 = new Battery (60);
            myRover.AddBattery (bat1);
            myRover.AddBattery (bat2);
            myRover.AddBattery (bat3);

            myRover.AttachDevice(myRadar);

            Assert.IsTrue(myRadar.Connected == true);
        }
Пример #6
0
        public void TestNotConnected()
        {
            Rover myRover = new Rover();
            Radar myRadar = new Radar();
            myRover.AttachDevice(myRadar);

            Assert.IsTrue(myRadar.Connected == false);
        }
Пример #7
0
        public void TestSolar()
        {
            Rover myRover = new Rover();
            SolarPanel mySolar = new SolarPanel();
            Battery bat1 = new Battery (50);
            myRover.AddBattery (bat1);
            myRover.AttachDevice(mySolar);
            Assert.IsTrue(mySolar.Battery.Charge == 50);
            Assert.IsTrue(mySolar.Connected == true);

            mySolar.Operate ();
            Assert.IsTrue(mySolar.Battery.Charge == 51, mySolar.Battery.Charge.ToString());
        }
Пример #8
0
        public void TestRadar()
        {
            Rover myRover = new Rover();
            Radar myRadar = new Radar();
            Battery bat1 = new Battery (50);
            myRover.AddBattery (bat1);
            myRover.AttachDevice(myRadar);
            Assert.IsTrue(myRadar.Battery.Charge == 50);
            Assert.IsTrue(myRadar.Connected == true);

            myRadar.Operate ();
            Assert.IsTrue(myRadar.Battery.Charge == 46);
        }