Beispiel #1
0
        public void CopyResultsOutputFilesToResultsOutputLocation(string workingDirectory, string resultsOutputLocation)
        {
            if (resultsOutputLocation != null)
            {
                if (!_directoryProvider.DoesDirectoryExists(workingDirectory))
                {
                    throw new ArgumentNullException(WorkingDirectoryNotExistExceptionMessage);
                }

                CopyAll(workingDirectory, resultsOutputLocation);
            }
        }
Beispiel #2
0
 private void EnsureResultsDirectoryExists(string testResultsFolder)
 {
     if (!_directoryProvider.DoesDirectoryExists(testResultsFolder))
     {
         _directoryProvider.CreateDirectory(testResultsFolder);
     }
 }
Beispiel #3
0
 private void DeleteTempExecutionFolder(string tempExecutionFolder)
 {
     if (_directoryProvider.DoesDirectoryExists(tempExecutionFolder))
     {
         _directoryProvider.Delete(tempExecutionFolder, true);
     }
 }
Beispiel #4
0
 private void DeleteTempExecutionFolder(string tempExecutionFolder)
 {
     if (_directoryProvider.DoesDirectoryExists(tempExecutionFolder))
     {
         try
         {
             _directoryProvider.Delete(tempExecutionFolder, true);
         }
         catch (UnauthorizedAccessException)
         {
             _consoleProvider.Write("The temp execution couldn't be deleted. You should start the agent with Administrative permissions.");
         }
     }
 }
Beispiel #5
0
        public async Task <string> CreateDumpAsync(string dumpLocation)
        {
            var dumpFileLocation = dumpLocation;

            if (string.IsNullOrEmpty(dumpFileLocation))
            {
                dumpFileLocation = _reflectionProvider.GetRunningAssemblyPath();
            }
            else
            {
                if (!_directoryProvider.DoesDirectoryExists(dumpLocation))
                {
                    try
                    {
                        _directoryProvider.CreateDirectory(dumpLocation);
                        _consoleProvider.WriteLine($"{dumpLocation} doesn't exists.");
                        _consoleProvider.WriteLine($"{dumpLocation} created.");
                    }
                    catch (IOException e)
                    {
                        _consoleProvider.WriteLine(e.ToString());
                        _consoleProvider.WriteLine($"{dumpLocation} cannot be created.");
                        throw;
                    }
                }
            }

            var exceptionLogs = (await _logRepository.GetAllAsync()).ToList();
            var sb            = new StringBuilder();

            foreach (var exceptionLog in exceptionLogs)
            {
                sb.AppendLine($"{exceptionLog.Date} {exceptionLog.Message} {exceptionLog.Exception}");
            }

            var uniqueFileName = string.Concat(GenerateUniqueText(), ".txt");
            var filePath       = _pathProvider.Combine(dumpFileLocation, uniqueFileName);

            _fileProvider.WriteAllText(filePath, sb.ToString());
            _consoleProvider.WriteLine($"dump file created successfully - {filePath}");

            return(filePath);
        }