public void Startup() { _directoryWrapper = new DirectoryWrapper(); if (_directoryWrapper.Exists(ResourcesBackup)) { _directoryWrapper.Delete(ResourcesBackup, true); } if (_directoryWrapper.Exists(EnvironmentVariables.ResourcePath)) { _directoryWrapper.Move(EnvironmentVariables.ResourcePath, ResourcesBackup); } var serverUnderTest = Process.GetProcessesByName("Warewolf Server")[0]; string exePath; try { exePath = Path.GetDirectoryName(serverUnderTest.MainModule?.FileName); } catch (Win32Exception) { exePath = Environment.CurrentDirectory; } var destDirName = Path.Combine(exePath, "Resources"); if (!_directoryWrapper.Exists(destDirName)) { _directoryWrapper.Move(Path.Combine(exePath, "Resources - Release", "Resources"), destDirName); } }
public void DeleteAllTests(Guid resourceId) { var dirPath = GetTestPathForResourceId(resourceId); if (_directoryWrapper.Exists(dirPath)) { _directoryWrapper.Delete(dirPath, true); Tests.TryRemove(resourceId, out List <IServiceTestModelTO> removedTests); } }
public void DeleteAllCoverageReports(Guid resourceId) { var dirPath = GetTestCoveragePathForResourceId(resourceId); if (_directoryWrapper.Exists(dirPath)) { _directoryWrapper.Delete(dirPath, true); TestCoverageReports.TryRemove(resourceId, out _); } }
public void Cleanup() { if (_directoryWrapper.Exists(EnvironmentVariables.ResourcePath)) { _directoryWrapper.Delete(EnvironmentVariables.ResourcePath, true); } if (_directoryWrapper.Exists(ResourcesBackup)) { _directoryWrapper.Move(ResourcesBackup, EnvironmentVariables.ResourcePath); } ExecuteRequest(new Uri("http://localhost:3142/services/FetchExplorerItemsService.json?ReloadResourceCatalogue=true")); }
public void EnvironmentVariables_WorkflowDetailLogPath_ShouldReturnDetailedLogsInProgramData() { //------------Setup for test-------------------------- const string folderPart = "ProgramData\\Warewolf\\DetailedLogs"; //------------Execute Test--------------------------- var folderPath = EnvironmentVariables.WorkflowDetailLogPath(It.IsAny <Guid>(), It.IsAny <string>()); //------------Assert Results------------------------- StringAssert.Contains(folderPath, folderPart); var directory = new DirectoryWrapper(); directory.Delete(folderPath, true); }