Esempio n. 1
0
        public void ProgramService_Runas_WhenAValidSetOfConsoleParametersIsSentAValidProcessIsReturned()
        {
            // Arrange
            string            program           = null;
            NetworkCredential networkCredential = null;
            bool   loadProfile = false;
            bool   env         = false;
            bool   netonly     = false;
            bool   savecred    = false;
            bool   smartcard   = false;
            string trustlevel  = null;

            // Act
            programService.Runas(
                program,
                networkCredential,
                loadProfile,
                env,
                netonly,
                savecred,
                smartcard,
                trustlevel);

            // Assert
            Assert.Fail();
        }
Esempio n. 2
0
        static void Main(string[] args)
        {
            var input = string.Empty;

            using (programService)
            {
                while (input != "Salir")
                {
                    System.Console.WriteLine("Elija una opción:\n");
                    foreach (var program in programDictionary)
                    {
                        System.Console.WriteLine(program.Key);
                    }

                    input = System.Console.ReadLine();
                    if (input == "Salir")
                    {
                        break;
                    }

                    if (input == "Listar")
                    {
                        foreach (var serviceProcess in programService.GetProcesses(null))
                        {
                            System.Console.WriteLine(serviceProcess.ToString());
                            continue;
                        }
                    }

                    var process = programDictionary.SingleOrDefault(p => p.Key == input).Value;
                    if (string.IsNullOrEmpty(process))
                    {
                        System.Console.WriteLine("Opción no válida!");
                    }
                    else
                    {
                        programService.Runas(process, null, null);
                    }
                }
            }

            System.Console.ReadLine();
        }