def test200_9930ShouldRaiseExceptionOnInvalidFrameRate(self): with self.assertRaises(ValueError) as context: myController = Controller.Controller() myController.initialize(architectureFile="invalid6.xml")
def test300_010_ShouldRunController(self): myController = Controller.Controller() myController.initialize(architectureFile="frameConfiguration.xml") self.assertEquals(myController.run(10000000), 10000000)
def test200_960ShouldRaiseExceptionOnFileEmpty(self): with self.assertRaises(ValueError) as context: myController = Controller.Controller() myController.initialize(architectureFile="Empty.xml")
def test200_9920ShouldRaiseExceptionOnMissingDeviceParm(self): with self.assertRaises(ValueError) as context: myController = Controller.Controller() myController.initialize(architectureFile="invalid5.xml")
def test200_940ShouldRaiseExceptionOnMissingFileName(self): with self.assertRaises(ValueError) as context: myController = Controller.Controller() myController.initialize()
def test200_950ShouldRaiseExceptionOnFileNotString(self): with self.assertRaises(ValueError) as context: myController = Controller.Controller() myController.initialize(architectureFile=2)
def test200_920ShouldRaiseExceptionOnIncorrectFileExtension(self): with self.assertRaises(ValueError) as context: myController = Controller.Controller() myController.initialize(architectureFile="file.csv")
def test300_920ShouldRaiseExceptionOnMicrosecondsLessThanEqualToZero(self): with self.assertRaises(ValueError) as context: myController = Controller.Controller() myController.initialize(architectureFile="frameConfiguration.xml") myController.run(0)
def test200_030_ShouldInitializeWithNewArchitectureFile(self): myController = Controller.Controller() architectureFile = "file3.xml" result = ['Device', 'StarSensor', 'SolarCollector'] self.assertEquals(myController.initialize(architectureFile), result)
def test200_910ShouldRaiseExceptionOnIncorrectFileName(self): with self.assertRaises(ValueError) as context: myController = Controller.Controller() myController.initialize(architectureFile="Xfile.xml")
def test200_020_ShouldInitializeWithArchitectureFileReturnEmptyList(self): myController = Controller.Controller() architectureFile = "file2.xml" self.assertEquals(myController.initialize(architectureFile), [])
def test300_940ShouldRaiseExceptionOnMissingInitialization(self): with self.assertRaises(ValueError) as context: myController = Controller.Controller() myController.run(1000)
def test300_930ShouldRaiseExceptionOnMicrosecondsNotAnInteger(self): with self.assertRaises(ValueError) as context: myController = Controller.Controller() myController.initialize(architectureFile="frameConfiguration.xml") myController.run("abc")
def test300_020_ShouldRunControllerWithMicrosecondsLessThanFrameRate(self): myController = Controller.Controller() myController.initialize(architectureFile="frameConfiguration.xml") self.assertEquals(myController.run(40), 120)
def test200_930ShouldRaiseExceptionOnFileNameLessThanOne(self): with self.assertRaises(ValueError) as context: myController = Controller.Controller() myController.initialize(architectureFile=".xml")
import CA03.prod.Controller as Controller theController = Controller.Controller() deviceList = theController.initialize("frameConfiguration.xml") for device in deviceList: print(device) runTime = theController.run(1000) print('The simulation ran for {0} microseconds'.format(runTime))
def test100_010_ShouldConstruct(self): self.assertIsInstance(Controller.Controller(), Controller.Controller)