public void ReturnNewProcessReferenceIfProcessNotFound()
        {
            var processRetriever = new ProcessRetriever();

            using (var process = Process.GetCurrentProcess())
            {
                Assert.IsType(typeof(ProcessWrapper), processRetriever.GetProcessById(process.Id));
            }
        }
        public void ReturnSameProcessReferenceIfProcessFoundAndNotExited()
        {
            var processRetriever = new ProcessRetriever();

            using (var process = Process.GetCurrentProcess())
            {
                var referencedProcess1 = processRetriever.GetProcessById(process.Id);
                var referencedProcess2 = processRetriever.GetProcessById(process.Id);

                Assert.Same(referencedProcess1, referencedProcess2);
            }
        }
        public void ReturnCachedProcessReferenceIfProcessExits()
        {
            var processRetriever = new ProcessRetriever();

            using (var process = Process.Start(new ProcessStartInfo("cmd")
            {
                CreateNoWindow = true, WindowStyle = ProcessWindowStyle.Hidden
            }))
            {
                Assert.IsType(typeof(ProcessWrapper), processRetriever.GetProcessById(process.Id));

                process.KillAndWaitForExit();

                Assert.IsType(typeof(ProcessWrapper), processRetriever.GetProcessById(process.Id));
            }
        }
        public void ReturnUnknownProcessIfProcessExitedBeforeWrapped()
        {
            var processRetriever = new ProcessRetriever();

            using (var process = Process.Start(new ProcessStartInfo("cmd")
            {
                CreateNoWindow = true, WindowStyle = ProcessWindowStyle.Hidden
            }))
            {
                var processId = process.Id;

                process.KillAndWaitForExit();

                Assert.IsType(typeof(UnknownProcess), processRetriever.GetProcessById(processId));
            }
        }
        public void ReturnUnknownProcessIfProcessIdNotFound()
        {
            var processRetriever = new ProcessRetriever();

            Assert.IsType(typeof(UnknownProcess), processRetriever.GetProcessById(9999999));
        }