Beispiel #1
0
        public void SetConfiguration_should_set_config_from_properties()
        {
            // given
            var task     = new PowershellTask(_powershellMock);
            var config   = new PowershellTaskConfig();
            var commands = new List <object>()
            {
                "ls", "echo hello"
            };

            var properties = new Dictionary <object, object>();

            properties["commands"] = commands;

            // when
            task.SetConfiguration(config, properties);

            // then
            var actualconfig = task.Config as PowershellTaskConfig;

            Assert.That(actualconfig, Is.Not.Null);

            Assert.That(actualconfig.Commands.Count, Is.EqualTo(2));
            Assert.That(actualconfig.Commands[0], Is.EqualTo("ls"));
            Assert.That(actualconfig.Commands[1], Is.EqualTo("echo hello"));
        }
Beispiel #2
0
        public void Run_should_set_powershell_runner_commands()
        {
            // given
            var task     = new PowershellTask(_powershellMock);
            var config   = new PowershellTaskConfig();
            var commands = new List <object>()
            {
                "ls", "echo hello"
            };

            var properties = new Dictionary <object, object>();

            properties["commands"] = commands;
            task.SetConfiguration(config, properties);

            // when
            task.Run(_logger);

            // then
            Assert.That(_powershellMock.Commands.Length, Is.EqualTo(2));
            Assert.That(_powershellMock.Commands[0], Is.EqualTo(commands[0]));
            Assert.That(_powershellMock.Commands[1], Is.EqualTo(commands[1]));
        }