Exemplo n.º 1
0
        public async Task CommandGetsResponseTestAsync()
        {
            using MemoryStream inputStream = new MemoryStream(Encoding.UTF8.GetBytes("\r\n+CSQ: 25,99\r\n\r\nOK\r\n\r\n"))
                  {
                      Position = 0
                  };
            using MemoryStream outputStream = new MemoryStream(1024);
            using TestableAtChannel channel = new TestableAtChannel(inputStream, outputStream);

            Task <(AtError error, AtResponse response)> commandTask = channel.SendSingleLineCommandAsync("AT+CSQ", "+CSQ");

            channel.StartReaderLoop();
            (AtError error, AtResponse response) = await commandTask;

            Assert.Equal(AtError.NO_ERROR, error);
            Assert.Equal("+CSQ: 25,99", response.Intermediates.First());
            Assert.Equal("OK", response.FinalResponse);
        }