public async Task <bool> PowerOff()
        {
            var sendCommand       = new PowerOffCommand();
            var tlSerialPortAsync = new TLAutoDeviceSerialPortAsync <bool>(TLAutoDeviceSerialPort, sendCommand, null, _logModuleName, _timeOutMs);

            return(await tlSerialPortAsync.InvokeAsync());
        }
Esempio n. 2
0
        public void Successful_Scenario_Test()
        {
            SetupWrite(ftdiMock, new byte[] { 0xe2 });

            var sut    = new PowerOffCommand();
            var result = sut.Execute(ftdiMock.Object);

            result.Success.Should().BeTrue();
        }
Esempio n. 3
0
        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);
        }
Esempio n. 4
0
        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();
        }