public void ToStringIgnoredLineTest2()
        {
            ConsoleOutputReceiver receiver = new ConsoleOutputReceiver();

            receiver.AddOutput("Hello, World!");
            receiver.AddOutput("$See you!");

            receiver.Flush();

            Assert.AreEqual("Hello, World!\r\n",
                            receiver.ToString());
        }
예제 #2
0
        public void ToStringTest()
        {
            ConsoleOutputReceiver receiver = new ConsoleOutputReceiver();

            receiver.AddOutput("Hello, World!");
            receiver.AddOutput("See you!");

            receiver.Flush();

            Assert.Equal("Hello, World!\r\nSee you!\r\n",
                         receiver.ToString());
        }
예제 #3
0
        public void ToStringIgnoredLineTest2()
        {
            ConsoleOutputReceiver receiver = new ConsoleOutputReceiver();

            receiver.AddOutput("Hello, World!");
            receiver.AddOutput("$See you!");

            receiver.Flush();

            Assert.Equal("Hello, World!\r\n",
                         receiver.ToString(),
                         ignoreLineEndingDifferences: true);
        }
        /// <summary>
        /// Execute adb command to selected device
        /// </summary>
        /// <param name="command"></param>
        /// <returns></returns>
        internal string Execute(string command, [CallerLineNumber] int lineNumber = 0, [CallerMemberName] string caller = null)
        {
            if (selectedDevice == null)
            {
                if (string.IsNullOrEmpty(adbipport))
                {
                    Console.Error.WriteLine("No adbipport registered. Please check you called SelectDevice(string adbipsocket)");
                    return(string.Empty);
                }
                if (!SelectDevice(adbipport))
                {
                    Console.Error.WriteLine("No such device found");
                    return(string.Empty);
                }
            }
            ConsoleOutputReceiver receiver = new ConsoleOutputReceiver();

            try
            {
                client.ExecuteRemoteCommand(command, selectedDevice, receiver);
            }
            catch (Exception ex)
            {
                if (ex.Message.Contains("device offline"))
                {
                    throw new Exception("device offline");
                }
                receiver.AddOutput(ex.ToString());
            }
            logger.WritePrivateLog("Execute " + command + " Result:" + receiver.ToString(), lineNumber, caller);
            return(receiver.ToString());
        }