Example #1
0
        public void Run_should_parse_localfile_paths(string inputFilePath, string expectedFilePath)
        {
            // given
            _fileProviderMock.CurrentDirectory = "c:\\currentdir";
            var task   = new PowershellFileTask(_fileProviderMock, _runnerMock);
            var config = new PowershellFileTaskConfig();

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

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

            // when
            task.Run(_logger);

            // then
            Assert.That(_runnerMock.ActualTempFilename, Is.EqualTo(expectedFilePath));
        }
Example #2
0
        public void Run_should_parse_and_run_remotefiles()
        {
            // given
            _fileProviderMock.DownloadContent = "echo hello-world";
            _fileProviderMock.TempFilePath    = "expected-tempfilename.ps1";
            var task = new PowershellFileTask(_fileProviderMock, _runnerMock);

            var config = new PowershellFileTaskConfig();

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

            properties["uri"] = "http://www.example.com/powershell.ps1";
            task.SetConfiguration(config, properties);

            // when
            task.Run(_logger);

            // then
            Assert.That(_runnerMock.ActualTempFilename, Is.EqualTo(_fileProviderMock.TempFilePath));
        }
Example #3
0
        public void SetConfiguration_should_set_config_from_properties()
        {
            // given
            var task   = new PowershellFileTask(_fileProviderMock, _runnerMock);
            var config = new PowershellFileTaskConfig();

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

            properties["uri"] = "http://www.example.com/powershell.ps1";

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

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

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

            Assert.That(actualconfig.Uri, Is.EqualTo("http://www.example.com/powershell.ps1"));
        }