public async Task SendTelegramVoiceMessageTest() { using var cancellationTokenSource = new CancellationTokenSource(TimeSpan.FromSeconds(30)); var cancellationToken = cancellationTokenSource.Token; await using var moduleService = new StaticModuleService( TestModules.CreateDefaultRecorder(), TestModules.CreateDefaultRecognizer(), TestModules.CreateTelegramRunner() ); await using var recognitionService = new RecognitionService(moduleService); await using var runnerService = new RunnerService(moduleService, moduleService, recognitionService); using var exceptions = new IServiceBase[] { moduleService, recognitionService, runnerService }.EnableLogging(cancellationTokenSource); moduleService.Add(new RecognitionServiceRunner(recognitionService)); var process = runnerService.Start(new Command("send-telegram-voice-message"), cancellationToken); await Task.Delay(TimeSpan.FromSeconds(5), cancellationToken); var value = await process.StopAsync(cancellationToken); Assert.AreNotEqual(0, value.Output.Data.Length); }
public async Task SelectScreenshotClipboardTest() { using var cancellationTokenSource = new CancellationTokenSource(TimeSpan.FromSeconds(30)); var cancellationToken = cancellationTokenSource.Token; using var app = await TestWpfApp.CreateAsync(cancellationToken); await using var moduleService = new StaticModuleService( new SelectRunner(app.Dispatcher), new ScreenshotRunner(), new ClipboardRunner(app.Dispatcher) ); await using var runnerService = new RunnerService( moduleService, moduleService ); using var exceptions = new IServiceBase[] { moduleService, runnerService }.EnableLogging(cancellationTokenSource); moduleService.Add(new ProcessSequenceRunner(runnerService)); var process = runnerService.Start(new Command( "process-sequence", "3", "select", "screenshot", "clipboard-set-image" ), cancellationToken); await Task.Delay(TimeSpan.FromSeconds(5), cancellationToken); await process.StopAsync(cancellationToken); await runnerService.WaitAllAsync(cancellationToken); }