public void ShouldCreateTheCm11DriverBasedOnType() { X10Configuration configuration = new X10Configuration(); configuration.DeviceType = ControllerType.CM11.ToString(); configuration.ComPort = "COM1"; LowLevelDriverFactory factory = new LowLevelDriverFactory(configuration); try { IX10LowLevelDriver driver = factory.getDriver(); // factory will return null driver if it can't create one - caller needs to check! if (driver != null) { Assert.IsInstanceOfType(typeof(Cm11LowLevelDriver), driver, "driver should be correct type"); } } catch (ApplicationException appEx) { // this test only works if COM1 is available...fail if the message is anything other than // something about the com port not being there. Assert.IsTrue(appEx.InnerException.Message.Contains("The port 'COM1' does not exist."), "threw an exception, but the message was wrong"); } }
public void ShouldCreateTheCm17aDriverBasedOnType() { X10Configuration configuration = new X10Configuration(); configuration.DeviceType = ControllerType.CM17A.ToString(); configuration.ComPort = "COM1"; LowLevelDriverFactory factory = new LowLevelDriverFactory(configuration); IX10LowLevelDriver driver = factory.getDriver(); // factory will return null driver if it can't create one - caller needs to check! if (driver != null) { Assert.IsInstanceOfType(typeof(Cm17LowLevelDriver), driver); } }