public void ReadTestData() { Args args = new Args("Test.txt", ";", "Test.txt"); FetchData fd = new FetchData(args); Assert.IsTrue(fd.Execute() != null); }
public void NullOnMissingFile() { FetchData fd1 = new FetchData(new Args("Missing.txt", ";", "Test.txt")); FetchData fd2 = new FetchData(new Args("/fake/path.txt", ";", "Test.txt")); Assert.Throws(typeof(CommandException), () => fd1.Execute()); Assert.Throws(typeof(CommandException), () => fd2.Execute()); }
private void UpdateTimer_Tick(object sender, EventArgs e) { OnPropertyChanged(nameof(TimeLeft)); OnPropertyChanged(nameof(TimeFetchLeft)); OnPropertyChanged(nameof(DeviceSerial)); OnPropertyChanged(nameof(ImitatorSerial)); if (DateTime.Now - lastMeasurment > FetchSpan) { lastMeasurment = DateTime.Now; if (!IsFetching) { FetchData.Execute(null); } } }
/// <summary> /// Executes this command pipeline. /// </summary> /// <exception cref="TextDedup.Library.Error.CommandException">When an exception occurs, it will be wrapped by this exception type and thrown.</exception> public void Execute() { ProcessArgs step1Command = new ProcessArgs(_args); Args step1Results = step1Command.Execute(); if (step1Results == null) { _logger?.Write("The pipeline is aborting because step 1 did not complete successfully."); return; } FetchData step2Command = new FetchData(step1Results); string step2Results = step2Command.Execute(); DedupString step3Command = new DedupString(step2Results, step1Results.Delimiter); string step3Results = step3Command.Execute(); SaveDedupedData step4Command = new SaveDedupedData(step1Results.Destination, step3Results); step4Command.Execute(); }