public void AddBatery(Battery bat) { _battery = bat; if(bat == null) connected = false; else connected = true; }
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); }
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); }
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); }
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); }
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()); }
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); }
public void RemoveBattery(Battery b) { _batteries.Remove (b); }
public void AddBattery(Battery b) { _batteries.Add (b); }