示例#1
0
 public MainWindowViewModel(IAdbService adbService)
 {
     PlayAgainCommand      = new DelegateCommand(ExecutePlayAgainCommand);
     TakeScreenshotCommand = new DelegateCommand(ExecuteTakeScreenshotCommand);
     _random     = new Random();
     _adbService = adbService;
 }
示例#2
0
        public AdbServiceTests()
        {
            _fileSystemMock = new MockFileSystem();
            _adbServer      = Substitute.For <IAdbServer>();

            var adbClient          = Substitute.For <IAdbClient>();
            var syncServiceFactory = Substitute.For <ISyncServiceFactory>();

            _environmentServiceMock = Substitute.For <IEnvironmentService>();

            _adbService = new AdbService(
                _fileSystemMock,
                _adbServer,
                adbClient,
                syncServiceFactory,
                _environmentServiceMock);
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="AndroidDevice"/> class.
 /// </summary>
 /// <param name="configuration">Device Configuration</param>
 /// <param name="adbService">Service to handle communication with adb</param>
 /// <param name="uiService">Service to handle UI</param>
 /// <param name="settingsService">Service to handle settings</param>
 /// <param name="activityService">Service to handle activities</param>
 /// <param name="interactionService">Service to handle interaction with the device</param>
 public AndroidDevice(
     DeviceConfiguration configuration,
     IAdbService adbService,
     IUiService uiService,
     ISettingsService settingsService,
     IActivityService activityService,
     IInteractionService interactionService)
 {
     Configuration = configuration;
     Adb           = adbService;
     Ui            = uiService;
     Settings      = settingsService;
     Activity      = activityService;
     Interaction   = interactionService;
     SetOwner();
     InstallHelperApks();
 }
 public void InstallDependenciesIfMissing(IAdbService adbService, IActivityService activityService, DeviceConfiguration configuration)
 {
     DeviceLogger.Log("Checking if helper is installed..");
     if (!activityService.IsPackagedInstalled("com.testura.server"))
     {
         DeviceLogger.Log("..not installed.");
         InstallDependencies(adbService, configuration);
     }
     else
     {
         DeviceLogger.Log("..already installed.");
         var latestVersion = Version.Parse(DeviceConfiguration.ServerApkVersion);
         if (activityService.GetPackageVersion("com.testura.server") < latestVersion)
         {
             DeviceLogger.Log("But you don't have the current/latest version. Updating your dependencies");
             InstallDependencies(adbService, configuration);
         }
     }
 }
 public void InstallDependencies(IAdbService adbService, DeviceConfiguration configuration)
 {
     DeviceLogger.Log("Installing all dependencies..");
     adbService.InstallApp(Path.Combine(configuration.DependenciesDirectory, DeviceConfiguration.ServerApkName));
     adbService.InstallApp(Path.Combine(configuration.DependenciesDirectory, DeviceConfiguration.ServerUiAutomatorApkName));
 }