public static ControllableProcess CreateControllableProcess(int processId, global::Aspenlaub.Net.GitHub.CSharp.Tash.ControllableProcessStatus status, global::System.DateTimeOffset confirmedAt) { ControllableProcess controllableProcess = new ControllableProcess(); controllableProcess.ProcessId = processId; controllableProcess.Status = status; controllableProcess.ConfirmedAt = confirmedAt; return(controllableProcess); }
protected async Task EnsureControllableProcessAsync(CacheckWindowUnderTest sut) { if (ControllableProcess != null) { return; } ControllableProcess = await sut.FindIdleProcessAsync(); }
public ControllableProcessTask CreateControllableProcessTask(ControllableProcess process, string type, string controlName, string text) { return(new ControllableProcessTask { Id = Guid.NewGuid(), ProcessId = process.ProcessId, Type = type, ControlName = controlName, Status = ControllableProcessTaskStatus.Requested, Text = text }); }
public async Task <ControllableProcess> FindIdleProcessAsync() { if (!Initialized) { throw new Exception("InitializeAsync has not been called"); } ControllableProcess process = null; await Wait.UntilAsync(async() => (process = await TryFindIdleProcess()) != null, TimeSpan.FromSeconds(60)); Assert.IsNotNull(process); return(process); }
public async Task <HttpStatusCode> PutControllableProcessAsync(Process process) { using (_SimpleLogger.BeginScope(SimpleLoggingScopeId.Create(nameof(PutControllableProcessAsync)))) { var methodNamesFromStack = _MethodNamesFromStackFramesExtractor.ExtractMethodNamesFromStackFrames(); _SimpleLogger.LogInformationWithCallStack($"Put controllable process with id={process.Id}", methodNamesFromStack); var context = new DefaultContainer(new Uri(BaseUrl)); ControllableProcess controllableProcess; if ((await ProcessExists(context, process.Id)).YesNo) { _SimpleLogger.LogInformationWithCallStack($"Update controllable process with id={process.Id}", methodNamesFromStack); controllableProcess = await context.ControllableProcesses.ByKey(process.Id).GetValueAsync(); controllableProcess.Title = process.ProcessName; controllableProcess.Status = ControllableProcessStatus.Idle; controllableProcess.ConfirmedAt = DateTimeOffset.Now; controllableProcess.LaunchCommand = process.MainModule?.FileName; context.UpdateObject(controllableProcess); } else { _SimpleLogger.LogInformationWithCallStack($"Insert controllable process with id={process.Id}", methodNamesFromStack); controllableProcess = new ControllableProcess { ProcessId = process.Id, Title = process.ProcessName, Status = ControllableProcessStatus.Idle, ConfirmedAt = DateTimeOffset.Now, LaunchCommand = process.MainModule?.FileName }; context.AddToControllableProcesses(controllableProcess); } var response = await context.SaveChangesAsync(SaveChangesOptions.ReplaceOnUpdate); var statusCode = response.Select(r => (HttpStatusCode)r.StatusCode).FirstOrDefault(); return(statusCode); } }
public async Task RemotelyProcessTaskListAsync(ControllableProcess process, List <ControllableProcessTask> tasks) { var task = CreateControllableProcessTask(process, ControllableProcessTaskType.ProcessTaskList, "", JsonConvert.SerializeObject(tasks)); await SubmitNewTaskAndAwaitCompletionAsync(task); }
public ControllableProcessTask CreateResetTask(ControllableProcess process) { return(CreateControllableProcessTask(process, ControllableProcessTaskType.Reset, "", "")); }
public async Task RemotelyVerifyLabelAsync(ControllableProcess process, string controlName, string label) { var task = CreateVerifyLabelTask(process, controlName, label); await SubmitNewTaskAndAwaitCompletionAsync(task); }
public async Task <string> RemotelyGetValueAsync(ControllableProcess process, string controlName) { var task = CreateControllableProcessTask(process, ControllableProcessTaskType.GetValue, controlName, ""); return(await SubmitNewTaskAndAwaitCompletionAsync(task)); }
public ControllableProcessTask CreateVerifyWhetherEnabledTask(ControllableProcess process, string controlName, bool enabled) { return(CreateControllableProcessTask(process, ControllableProcessTaskType.VerifyWhetherEnabled, controlName, enabled ? "true" : "false")); }
public ControllableProcessTask CreateVerifyItemsTask(ControllableProcess process, string controlName, IList <string> names) { return(CreateControllableProcessTask(process, ControllableProcessTaskType.VerifyItems, controlName, string.Join("^", names))); }
public ControllableProcessTask CreateVerifyNumberOfItemsTask(ControllableProcess process, string controlName, int expectedNumberOfItems) { return(CreateControllableProcessTask(process, ControllableProcessTaskType.VerifyNumberOfItems, controlName, expectedNumberOfItems.ToString())); }
public ControllableProcessTask CreateVerifyIntegrationTestEnvironmentTask(ControllableProcess process) { return(CreateControllableProcessTask(process, ControllableProcessTaskType.VerifyIntegrationTestEnvironment, "", "")); }
public async Task RemotelyPressButtonAsync(ControllableProcess process, string controlName, bool successIsExpected) { var task = CreatePressButtonTask(process, controlName); await SubmitNewTaskAndAwaitCompletionAsync(task, successIsExpected); }
public ControllableProcessTask CreatePressButtonTask(ControllableProcess process, string controlName) { return(CreateControllableProcessTask(process, ControllableProcessTaskType.PressButton, controlName, "")); }
public async Task RemotelySetValueAsync(ControllableProcess process, string controlName, string value) { var task = CreateSetValueTask(process, controlName, value); await SubmitNewTaskAndAwaitCompletionAsync(task); }
public void AddToControllableProcesses(ControllableProcess controllableProcess) { base.AddObject("ControllableProcesses", controllableProcess); }
public ControllableProcessTask CreateVerifyValueTask(ControllableProcess process, string controlName, string value) { return(CreateControllableProcessTask(process, ControllableProcessTaskType.VerifyValue, controlName, value)); }
public ControllableProcessTask CreateVerifyLabelTask(ControllableProcess process, string controlName, string label) { return(CreateControllableProcessTask(process, ControllableProcessTaskType.VerifyLabel, controlName, label)); }
public ControllableProcessTask CreateMaximizeTask(ControllableProcess process) { return(CreateControllableProcessTask(process, ControllableProcessTaskType.Maximize, "", "")); }