Esempio n. 1
0
        public void SendNotification(NotificationParameters parameters)
        {
            string GetCurrentDirectory() => Path.GetDirectoryName(Assembly.GetAssembly(typeof(NotificationManager)).Location);

            void SendWindowsToastNotification()
            {
                const string SendNotificationRelativePath = @"Resources\SendNotification.ps1";
                string       sendNotificationFullPath     = Path.Combine(GetCurrentDirectory(), SendNotificationRelativePath);
                string       args = parameters.ToPowershellArguments();
                var          p    = Process.Start("Powershell.exe", $"-ExecutionPolicy ByPass -File {sendNotificationFullPath} {args}");

                p.WaitForExit();
            }

            switch (RuntimeEnvironment.OperatingSystemPlatform)
            {
            case Platform.Windows:
                if (OSVersion != null && OSVersion >= WindowsMinimumVersionForToastNotificationManager)
                {
                    SendWindowsToastNotification();
                }
                break;

            default:
                break;
            }
        }
Esempio n. 2
0
 public static NotificationParameters ToNotificationParameters(this TestResultsHolder results) =>
 NotificationParameters.CreateTestsParameters(results.TestsFailed, results.TestsSkipped, results.TotalTests, results.Duration * 0.001);