Esempio n. 1
0
        public void StartApplication_Pipeline_Success(
            TestApplicationRepository applicationRepository,
            ApplicationController applicationController,
            ProcessLauncherMockup processLauncher,
            Application application,
            string pipeline)
        {
            var pipelineVariable = TemplateVariable.Pipeline(pipeline);

            var command = application.Commands[new Random().Next(0, application.Commands.Count - 1)];

            command.Arguments = new List <string> {
                pipelineVariable.Name
            };
            applicationRepository.AddApplication(application);


            applicationController.StartApplication(application.Name, command.Name, pipeline: pipeline);


            var process = processLauncher.Processes.FirstOrDefault(p => p.FileName == application.Executable);

            Assert.NotNull(process);
            Assert.Contains(pipeline, process.Arguments);
        }
Esempio n. 2
0
 public void StartApplication_RereadProcessVariables_Success(
     TestApplicationRepository applicationRepository,
     ApplicationController applicationController,
     ProcessLauncherMockup processLauncher,
     SystemVariableMockup systemVariable,
     Application application,
     List <(string Name, string Value)> processVariables)
Esempio n. 3
0
        public void StartApplication_DeleteVariables_Success(
            TestApplicationRepository applicationRepository,
            ApplicationController applicationController,
            ProcessLauncherMockup processLauncher,
            SystemVariableMockup systemVariable,
            Application application,
            List <string> deleteVariables)
        {
            deleteVariables.ForEach(name => systemVariable.AddVariable(name, name));
            var command = application.Commands[new Random().Next(0, application.Commands.Count - 1)];

            command.DeleteVariables        = deleteVariables.ToArray();
            command.RereadProcessVariables = false;
            command.RereadProcessVariables = false;
            command.RereadMachineVariables = false;
            command.ResetVariables         = false;
            applicationRepository.AddApplication(application);


            applicationController.StartApplication(application.Name, command.Name);


            var process = processLauncher.Processes.FirstOrDefault(p => p.FileName == application.Executable);

            Assert.NotNull(process);
            Assert.DoesNotContain(process.Environment.Keys, deleteVariables.Contains);
        }
Esempio n. 4
0
        public void StartApplication_Plain_Success(
            ApplicationRepository applicationRepository,
            ApplicationController applicationController,
            ProcessLauncherMockup processLauncher)
        {
            var application = applicationRepository.GetApplication(Application.Default);


            applicationController.StartApplication();


            Assert.Contains(processLauncher.Processes, p => p.FileName == application.Executable);
        }
Esempio n. 5
0
        public void StartApplication_ApplicationName_Success(
            TestApplicationRepository applicationRepository,
            ApplicationController applicationController,
            ProcessLauncherMockup processLauncher,
            Application application)
        {
            application.Commands[new Random().Next(0, application.Commands.Count - 1)].Name = Command.Default;
            applicationRepository.AddApplication(application);


            applicationController.StartApplication(application.Name);


            Assert.Contains(processLauncher.Processes, p => p.FileName == application.Executable);
        }
Esempio n. 6
0
        public void StartApplication_NoWindow_Success(
            TestApplicationRepository applicationRepository,
            ApplicationController applicationController,
            ProcessLauncherMockup processLauncher,
            Application application,
            bool noWindow)
        {
            var command = application.Commands[new Random().Next(0, application.Commands.Count - 1)];

            command.NoWindow = noWindow;
            applicationRepository.AddApplication(application);


            applicationController.StartApplication(application.Name, command.Name);


            var process = processLauncher.Processes.FirstOrDefault(p => p.FileName == application.Executable);

            Assert.NotNull(process);
            Assert.Equal(process.CreateNoWindow, noWindow);
        }