public void Retrieves_Correct_Process_Name_Before_Trace_Was_Started() { var process = Process.Start("cmd", "/c waitfor /T 10 kkkkkkk"); var eventTime = DateTime.Now; var processStore = new ProcessNameStore(); var name = processStore.ProcessName(process.Id, eventTime); process.Kill(); Assert.AreEqual("cmd", name); }
public void Retrieves_Correct_Process_Name_During_Trace() { var processStore = new ProcessNameStore(); Thread.Sleep(5000); var process = Process.Start("waitfor", "/T 10 tttttt"); var eventTime = DateTime.Now; Thread.Sleep(5000); var name = processStore.ProcessName(process.Id, eventTime); Assert.AreEqual("conhost", Path.GetFileNameWithoutExtension(name)); }
private void FileEventAvailable(FileIoEvent fileIo) { if (fileIo.Status == Success) { //do we have a not found which is now found? if (_files.ContainsKey(fileIo.Name)) { var file = _files[fileIo.Name]; _removeFile(file); } return; } if (!_files.ContainsKey(fileIo.Name)) { var file = new MissingFile(); file.Name = fileIo.Name; file.PID = fileIo.PID; file.Process = fileIo.Process; _files.Add(fileIo.Name, file); _displayFile(file); } var missingFile = _files[fileIo.Name]; missingFile.LastLookupAttempt = fileIo.Time; var searchEvent = new SearchEvent(); searchEvent.Path = Path.GetDirectoryName(fileIo.FullPath); searchEvent.Result = fileIo.Status; searchEvent.Process = _nameStore.ProcessName(fileIo.PID, fileIo.Time); searchEvent.PID = fileIo.PID; searchEvent.EventTime = fileIo.Time; _addEvent(missingFile, searchEvent); }