public JobManagement_Should(ITestOutputHelper output) { _output = output ?? throw new ArgumentNullException(nameof(output)); _searchCmd = new SearchJobs() { Config = OpnSenseDevice.Instance, Logger = this }; _addCmd = new AddJob() { Config = OpnSenseDevice.Instance, Logger = this }; _updateCmd = new UpdateJob() { Config = OpnSenseDevice.Instance, Logger = this }; _toggleCmd = new ToggleJob() { Config = OpnSenseDevice.Instance, Logger = this }; _getCmd = new GetJobDetails() { Config = OpnSenseDevice.Instance, Logger = this }; _deleteCmd = new DeleteJob() { Config = OpnSenseDevice.Instance, Logger = this }; }
public void DeleteJob_Action_Fails() { // Arrange var jobDto = TestHelper.JobDto(); GenericServiceResponse <bool> fakeResponse = null; mockClientServicesProvider.Setup(x => x.Logger).Returns(mockLogger.Object).Verifiable(); mockClientServicesProvider.Setup(x => x.JobService.DeleteJob(jobDto)).Returns(fakeResponse).Verifiable(); var viewModel = new GenericViewModel(); var action = new DeleteJob <GenericViewModel>(mockClientServicesProvider.Object) { OnComplete = model => viewModel = model }; // Act var result = action.Invoke(jobDto); // Assert Assert.IsNotNull(result); Assert.IsInstanceOfType(result, typeof(GenericViewModel)); Assert.IsNotNull(result.Notifications); Assert.IsInstanceOfType(result.Notifications, typeof(NotificationCollection)); Assert.IsTrue(result.Notifications.Count() == 1); Assert.IsTrue(result.HasErrors); Assert.IsNotNull(result.Success); Assert.IsInstanceOfType(result.Success, typeof(bool)); Assert.IsFalse(result.Success); }
public ActionResult deleteJobById(DeleteJob job) { if (ModelState.IsValid) { return(Ok(service.DeleteJobById(job.TaskId, job.JobId))); } return(BadRequest()); }
private void _remAllButton_Click(object sender, EventArgs e) { job = DeleteJob.All; _dateDisplay.Text = "ALL WEIGHTS WILL BE DELETED.\nThere will be no way to restore them. are you sure you want to continue?"; _dateSelectButton.Visibility = ViewStates.Gone; _remAllButton.Visibility = ViewStates.Gone; _remSingleButton.Visibility = ViewStates.Gone; FindViewById <Button>(Resource.Id.OKbutton).Visibility = ViewStates.Visible; FindViewById <Button>(Resource.Id.CancelButton).Visibility = ViewStates.Visible; }
public void RunSynchronously() { CancellationTokenSource cts = new CancellationTokenSource(); var delJob = new DeleteJob(new DeleteJobArguments(state.ExistingFiles[0]), state.OnProgressDebugPrint, cts.Token); delJob.Run(); state.ExistingFiles[0].Refresh(); Assert.IsFalse(state.ExistingFiles[0].Exists); }
public void DeleteNonEmptyDirectory() { var cts = new CancellationTokenSource(); var job = new DeleteJob(new DeleteJobArguments(state.ExistingNonEmptyDirectories[0], true), cts.Token); job.Run(); state.ExistingNonEmptyDirectories[0].Refresh(); Assert.IsFalse(state.ExistingNonEmptyDirectories[0].Exists); }
protected override JobHandle OnUpdate(JobHandle inputDeps) { if (m_targetEntity == Entity.Null) { var entities = m_transformQuery.ToEntityArray(Allocator.TempJob); m_targetEntity = entities.Length > 1 ? entities[0] : Entity.Null; entities.Dispose(); } if (Input.GetKeyDown(KeyCode.D)) { inputDeps = new DeleteJob { CmdBuffer = m_entityCommandBufferSystem.CreateCommandBuffer().ToConcurrent() } }
void DateSelect_OnClick(object sender, EventArgs eventArgs) { DatePickerFragment frag = DatePickerFragment.NewInstance(delegate(DateTime time) { _dateDisplay.Text = "All weights prior to " + time.ToLongDateString() + " will be deleted !"; datePicked = time; _dateSelectButton.Visibility = ViewStates.Gone; _remAllButton.Visibility = ViewStates.Gone; _remSingleButton.Visibility = ViewStates.Gone; job = DeleteJob.PriorToDate; FindViewById <Button>(Resource.Id.OKbutton).Visibility = ViewStates.Visible; FindViewById <Button>(Resource.Id.CancelButton).Visibility = ViewStates.Visible; }); frag.Show(FragmentManager, DatePickerFragment.TAG); }
private void _remSingleButton_Click(object sender, EventArgs e) { DatePickerFragment frag = DatePickerFragment.NewInstance(delegate(DateTime time) { _dateDisplay.Text = "All weighs on day " + time.ToLongDateString() + " will be deleted!"; datePicked = time.AddDays(1); //CreateAndShowDialog("Date Picked = " + time, ""); _dateSelectButton.Visibility = ViewStates.Gone; _remAllButton.Visibility = ViewStates.Gone; _remSingleButton.Visibility = ViewStates.Gone; job = DeleteJob.Single; FindViewById <Button>(Resource.Id.OKbutton).Visibility = ViewStates.Visible; FindViewById <Button>(Resource.Id.CancelButton).Visibility = ViewStates.Visible; }); frag.Show(FragmentManager, DatePickerFragment.TAG); }
public void TargetDoesNotExist() { CancellationTokenSource cts = new CancellationTokenSource(); var delJob = new DeleteJob( new DeleteJobArguments(state.NonExistingFiles[0]), state.OnProgressDebugPrint , cts.Token); try { delJob.Run(); } catch (DeleteException e) { state.ExceptionThrown = true; Assert.IsTrue(e.InnerException is FileNotFoundException); } Assert.IsTrue(state.ExceptionThrown); }
public void TargetWithoutRights() { CancellationTokenSource cts = new CancellationTokenSource(); var delJob = new DeleteJob(new DeleteJobArguments(state.ExistentFileWithoutRights), state.OnProgressDebugPrint, cts.Token); try { delJob.Run(); } catch (DeleteException e) { state.ExceptionThrown = true; Assert.IsTrue(e.InnerException is UnauthorizedAccessException); } state.ExistentFileWithoutRights.Refresh(); Assert.IsTrue(state.ExistentFileWithoutRights.Exists); Assert.IsTrue(state.ExceptionThrown); }
public void CanceledBeforeAndTargetDoesNotExist() { CancellationTokenSource cts = new CancellationTokenSource(); var delJob = new DeleteJob(new DeleteJobArguments(state.NonExistingFiles[0]), state.OnProgressDebugPrint, cts.Token); cts.Cancel(); var t = Task.Run(delJob.Run, cts.Token); try { t.Wait(); } catch (AggregateException ae) { Assert.IsTrue(ae.InnerExceptions.All(e => e is OperationCanceledException)); state.ExceptionThrown = true; } Assert.IsTrue(state.ExceptionThrown); }
public void OpenedHandle() { using (var fs = new FileStream(state.ExistingFiles[0].FullName, FileMode.Open)) { CancellationTokenSource cts = new CancellationTokenSource(); var delJob = new DeleteJob(new DeleteJobArguments(state.ExistingFiles[0]), state.OnProgressDebugPrint, cts.Token); try { delJob.Run(); } catch (DeleteException e) { state.ExceptionThrown = true; Assert.IsTrue(e.InnerException is IOException); } Assert.IsTrue(state.ExceptionThrown); state.ExistingFiles[0].Refresh(); Assert.IsTrue(state.ExistingFiles[0].Exists); } }
public bool DeleteJob(List<DbJob> jobs, int stream_id) { DeleteJob delJob = new DeleteJob(); return delJob.GetCommand(jobs, stream_id); }
void IJobVisitor.Visit(DeleteJob job) { DeleteArguments = job.Args; }