private static void RunBeforeAnyTests() { if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) { ScalarServiceProcess.InstallService(); string statusCacheVersionTokenPath = Path.Combine( Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles, Environment.SpecialFolderOption.Create), "Scalar", "ProgramData", "Scalar.Service", "EnableGitStatusCacheToken.dat"); if (!File.Exists(statusCacheVersionTokenPath)) { File.WriteAllText(statusCacheVersionTokenPath, string.Empty); } } }
public void RunAfterAllTests() { if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) { string serviceLogFolder = Path.Combine( Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData), "Scalar", ScalarServiceProcess.TestServiceName, "Logs"); Console.WriteLine("Scalar.Service logs at '{0}' attached below.\n\n", serviceLogFolder); foreach (string filename in TestResultsHelper.GetAllFilesInDirectory(serviceLogFolder)) { TestResultsHelper.OutputFileContents(filename); } ScalarServiceProcess.UninstallService(); } PrintTestCaseStats.PrintRunTimeStats(); }
private void RestartService() { ScalarServiceProcess.StopService(); ScalarServiceProcess.StartService(); }