Esempio n. 1
0
        public void DsfPathDelete_UpdateForEachInputs_1Update_Updates()
        {
            //------------Setup for test--------------------------
            var newGuid   = Guid.NewGuid();
            var inputPath = string.Concat(TestContext.TestRunDirectory, "\\", newGuid + "[[CompanyName]]2.txt");
            var act       = new DsfPathDelete {
                InputPath = inputPath, Result = "[[CompanyName]]"
            };

            var tuple1 = new Tuple <string, string>(inputPath, "Test");

            //------------Execute Test---------------------------
            act.UpdateForEachInputs(new List <Tuple <string, string> > {
                tuple1
            });
            //------------Assert Results-------------------------
            Assert.AreEqual("Test", act.InputPath);
        }
        public void GetActivityFieldsOffDsfPathDeleteActivityExpectedAllFindMissingFieldsToBeReturned()
        {
            var activity = new DsfPathDelete();

            activity.InputPath      = "[[InputPath]]";
            activity.Password       = "******";
            activity.Username       = "******";
            activity.PrivateKeyFile = "[[KeyFile]]";
            activity.Result         = "[[Result]]";
            var fac      = new Dev2FindMissingStrategyFactory();
            var strategy = fac.CreateFindMissingStrategy(enFindMissingType.StaticActivity);
            var actual   = strategy.GetActivityFields(activity);
            var expected = new List <string> {
                "[[InputPath]]", "[[Password]]", "[[Username]]", "[[KeyFile]]", "[[Result]]"
            };

            CollectionAssert.AreEqual(expected, actual);
        }
Esempio n. 3
0
        public void DsfPathDelete_UpdateForEachOutputs_MoreThan1Updates_DoesNothing()
        {
            //------------Setup for test--------------------------
            var          newGuid = Guid.NewGuid();
            const string result  = "[[CompanyName]]";
            var          act     = new DsfPathDelete {
                InputPath = string.Concat(TestContext.TestRunDirectory, "\\", newGuid + "[[CompanyName]]2.txt"), Result = result
            };

            var tuple1 = new Tuple <string, string>("Test", "Test");
            var tuple2 = new Tuple <string, string>("Test2", "Test2");

            //------------Execute Test---------------------------
            act.UpdateForEachOutputs(new List <Tuple <string, string> > {
                tuple1, tuple2
            });
            //------------Assert Results-------------------------
            Assert.AreEqual(result, act.Result);
        }
Esempio n. 4
0
        protected override void BuildDataList()
        {
            BuildShapeAndTestData();

            var delete = new DsfPathDelete
            {
                InputPath = ScenarioContext.Current.Get <string>(CommonSteps.SourceHolder),
                Username  = ScenarioContext.Current.Get <string>(CommonSteps.SourceUsernameHolder).ResolveDomain(),
                Password  = ScenarioContext.Current.Get <string>(CommonSteps.SourcePasswordHolder),
                Result    = ScenarioContext.Current.Get <string>(CommonSteps.ResultVariableHolder)
            };

            TestStartNode = new FlowStep
            {
                Action = delete
            };

            ScenarioContext.Current.Add("activity", delete);
        }
        public void DsfPathDelete_Execution_FileNotFound_DebugOutputErrorMessageRelevant()
        {
            var dsfPathDelete = new DsfPathDelete {
                InputPath = TestContext.TestRunDirectory + "\\some file that doesnt exist.txt", Result = "[[res]]"
            };
            List <DebugItem> inRes;
            List <DebugItem> outRes;
            string           actual;
            string           error;

            //------------Execute Test---------------------------
            var result = CheckPathOperationActivityDebugInputOutput(dsfPathDelete, "<ADL><FileNames><Name></Name></FileNames><res></res></ADL>",
                                                                    "<ADL><FileNames><Name></Name></FileNames><res></res></ADL>", out inRes, out outRes);

            GetScalarValueFromEnvironment(result.Environment, "Dev2System.Dev2Error", out actual, out error);

            // Assert Debug Output Error Message Relevant
            Assert.IsTrue(string.IsNullOrEmpty(actual) || !actual.Contains("null reference"), "Irrelevent error displayed for file not found.");

            //clean
        }
Esempio n. 6
0
        public void GivenContainsAnDeleteFolderAs(string parentName, string activityName, Table table)
        {
            var activity = new DsfPathDelete {
                DisplayName = activityName
            };

            foreach (var tableRow in table.Rows)
            {
                var variable = tableRow["Recordset"];
                //var userName = tableRow["Username"];
                //var password = tableRow["Password"];
                var result = tableRow["Result"];

                activity.Result    = result;
                activity.InputPath = variable;
                //activity.Username = userName;
                //activity.Password = password;

                _commonSteps.AddVariableToVariableList(result);
            }
            _commonSteps.AddActivityToActivityList(parentName, activityName, activity);
        }
Esempio n. 7
0
        protected override void BuildDataList()
        {
            if (!scenarioContext.ContainsKey("activity"))
            {
                BuildShapeAndTestData();

                scenarioContext.TryGetValue(CommonSteps.SourcePrivatePublicKeyFile, out string privateKeyFile);
                var delete = new DsfPathDelete
                {
                    InputPath      = scenarioContext.Get <string>(CommonSteps.SourceHolder),
                    Username       = scenarioContext.Get <string>(CommonSteps.SourceUsernameHolder).ResolveDomain(),
                    Password       = scenarioContext.Get <string>(CommonSteps.SourcePasswordHolder),
                    Result         = scenarioContext.Get <string>(CommonSteps.ResultVariableHolder),
                    PrivateKeyFile = privateKeyFile
                };

                TestStartNode = new FlowStep
                {
                    Action = delete
                };

                scenarioContext.Add("activity", delete);
            }
        }