/// <summary> /// Queries adb for its version number and checks it against <see cref="AdbServer.RequiredAdbVersion"/>. /// </summary> /// <returns> /// A <see cref="Version"/> object that contains the version number of the Android Command Line client. /// </returns> public Version GetVersion() { // Run the adb.exe version command and capture the output. List <string> standardOutput = new List <string>(); this.RunAdbProcess("version", null, standardOutput); // Parse the output to get the version. var version = GetVersionFromOutput(standardOutput); if (version == null) { throw new AdbException($"The version of the adb executable at {this.AdbPath} could not be determined."); } if (version < AdbServer.RequiredAdbVersion) { var ex = new AdbException($"Required minimum version of adb: {AdbServer.RequiredAdbVersion}. Current version is {version}"); this.logger.LogError(ex, ex.Message); throw ex; } return(version); }
public void Constructor_WithMessage_Works() { var ex = new AdbException("test."); Assert.Equal("test.", ex.Message); }
public void Constructor_Works() { var ex = new AdbException(); Assert.Equal("An unexpected ADB error occurred.", ex.Message); }