public void ReturnsCorrectProcess()
        {
            // Arrange
            var processProvider = new ProcessProvider();

            // Act
            var actualProcess   = processProvider.GetCurrentProcess();
            var expectedProcess = Process.GetCurrentProcess();

            // Assert
            Assert.That(actualProcess.ProcessName, Is.EqualTo(expectedProcess.ProcessName));
        }
Esempio n. 2
0
        public virtual void EnsurePriority(object sender)
        {
            try
            {
                var currentProcess = _processProvider.GetCurrentProcess();
                if (currentProcess.Priority != ProcessPriorityClass.Normal)
                {
                    _processProvider.SetPriority(currentProcess.Id, ProcessPriorityClass.Normal);
                }

                var iisProcess = _processProvider.GetProcessById(_iisProvider.IISProcessId);
                if (iisProcess != null && iisProcess.Priority != ProcessPriorityClass.Normal &&
                    iisProcess.Priority != ProcessPriorityClass.AboveNormal)
                {
                    _processProvider.SetPriority(iisProcess.Id, ProcessPriorityClass.Normal);
                }
            }
            catch (Exception e)
            {
                logger.WarnException("Unable to verify priority", e);
            }
        }