public void Execute_ExistingSamplePackageWithParameterWithInvalidValue_FailureWithMessage()
        {
            var destPath = DiskOnFile.GetDirectoryPath() + @"\/.txt";
            if (File.Exists(destPath))
                File.Delete(destPath);

            var etl = new EtlXml();
            etl.Path = @"Etl\";
            etl.Name = "Sample.dtsx";
            etl.Password = "******";
            var param = new EtlParameterXml();
            param.Name = "DestinationPath";
            param.StringValue = destPath;
            etl.InternalParameters.Add(param);

            var runner = new EtlFileRunner(etl);
            var result = runner.Run();

            Assert.That(result.IsSuccess, Is.False);
            Assert.That(result.Message, Is.StringContaining("invalid characters"));
        }
        public void Execute_ExistingSamplePackageWithParameter_SuccessAndParameterUsed()
        {
            var destPath = DiskOnFile.GetDirectoryPath() + "SampleFile.txt";
            if(File.Exists(destPath))
                File.Delete(destPath);

            var etl = new EtlXml();
            etl.Path = @"Etl\";
            etl.Name = "Sample.dtsx";
            etl.Password = "******";
            var param = new EtlParameterXml();
            param.Name="DestinationPath";
            param.StringValue = destPath;
            etl.InternalParameters.Add(param);

            var runner = new EtlFileRunner(etl);
            var result = runner.Run();

            Assert.That(result.IsSuccess, Is.True);
            Assert.That(File.Exists(destPath), Is.True);
        }
        public void Execute_ExistingSamplePackageWithVariable_SuccessAndParameterUsed()
        {
            var limitValue = 5;
            var destPath = DiskOnFile.GetDirectoryPath() + "VariableFile.txt";
            if (File.Exists(destPath))
                File.Delete(destPath);

            var etl = new EtlXml();
            etl.Path = @"Etl\";
            etl.Name = "Sample.dtsx";
            etl.Password = "******";
            var param = new EtlParameterXml();
            param.Name = "DestinationPath";
            param.StringValue = destPath;
            etl.InternalParameters.Add(param);

            var variable = new EtlParameterXml();
            variable.Name = "User::Limit";
            variable.StringValue = String.Format("top {0} *", limitValue);
            etl.InternalParameters.Add(variable);

            var runner = new EtlFileRunner(etl);
            var result = runner.Run();

            Assert.That(result.IsSuccess, Is.True);
            Assert.That(File.Exists(destPath), Is.True);

            var content = File.ReadAllLines(destPath);
            Assert.That(content.Count(), Is.EqualTo(limitValue+1));
        }
        public void Execute_ExistingSamplePackage_Success()
        {
            var etl = Mock.Of<IEtl>( e =>
                e.Server == string.Empty
                && e.Path == @"Etl\"
                && e.Name == "Sample.dtsx"
                && e.Password=="p@ssw0rd"
                && e.Parameters == new List<EtlParameter>()
                );

            var runner = new EtlFileRunner(etl);
            var result = runner.Run();

            Assert.That(result.IsSuccess, Is.True, "Expecting a success but was failure with following message:\r\n" + result.Message);
        }