public async Task <bool> PowerOff() { var sendCommand = new PowerOffCommand(); var tlSerialPortAsync = new TLAutoDeviceSerialPortAsync <bool>(TLAutoDeviceSerialPort, sendCommand, null, _logModuleName, _timeOutMs); return(await tlSerialPortAsync.InvokeAsync()); }
public void Successful_Scenario_Test() { SetupWrite(ftdiMock, new byte[] { 0xe2 }); var sut = new PowerOffCommand(); var result = sut.Execute(ftdiMock.Object); result.Success.Should().BeTrue(); }
public void ConstructorTest() { var sut = new PowerOffCommand(); sut.CommandCode.Should().Be(0xe2); sut.AcknowledgeCode.Should().Be(0x00); sut.RequiredBaudRate.Should().Be(250000); sut.Timeout.Should().Be(1000); }
static void Main(string[] args) { ISwitchable switcher = new LightSwitcher(); ICommand on = new PowerOnCommand(switcher); ICommand off = new PowerOffCommand(switcher); var invoker = new SwitchInvoker(on, off); Console.WriteLine("Lights ON =>"); invoker.LightOn(); Console.WriteLine(); Console.WriteLine("Lights OFF =>"); invoker.LightOff(); Console.WriteLine(); Console.ReadKey(); }