public void DsfFileWrite_UpdateForEachInputs_NullUpdates_DoesNothing() { //------------Setup for test-------------------------- var newGuid = Guid.NewGuid(); var inputPath = string.Concat(TestContext.TestRunDirectory, "\\", newGuid + "[[CompanyName]].txt"); var outputPath = string.Concat(TestContext.TestRunDirectory, "\\", newGuid + "[[CompanyName]]2.txt"); var act = new DsfFileWrite { FileContents = inputPath, OutputPath = outputPath, Result = "[[CompanyName]]" }; //------------Execute Test--------------------------- act.UpdateForEachInputs(null); //------------Assert Results------------------------- Assert.AreEqual(inputPath, act.FileContents); Assert.AreEqual(outputPath, act.OutputPath); }
public void DsfFileWrite_UpdateForEachInputs_MoreThan1Updates_Updates() { //------------Setup for test-------------------------- var newGuid = Guid.NewGuid(); var inputPath = string.Concat(TestContext.TestRunDirectory, "\\", newGuid + "[[CompanyName]].txt"); var outputPath = string.Concat(TestContext.TestRunDirectory, "\\", newGuid + "[[CompanyName]]2.txt"); var act = new DsfFileWrite { FileContents = inputPath, OutputPath = outputPath, Result = "[[CompanyName]]" }; var tuple1 = new Tuple<string, string>(outputPath, "Test"); var tuple2 = new Tuple<string, string>(inputPath, "Test2"); //------------Execute Test--------------------------- act.UpdateForEachInputs(new List<Tuple<string, string>> { tuple1, tuple2 }); //------------Assert Results------------------------- Assert.AreEqual("Test2", act.FileContents); Assert.AreEqual("Test", act.OutputPath); }
public void GetActivityFieldsOffDsfFileWriteActivityExpectedAllFindMissingFieldsToBeReturned() { DsfFileWrite activity = new DsfFileWrite(); activity.FileContents = "[[FileContents]]"; activity.OutputPath = "[[OutputPath]]"; activity.Password = "******"; activity.PrivateKeyFile = "[[KeyFile]]"; activity.Username = "******"; activity.Result = "[[Result]]"; Dev2FindMissingStrategyFactory fac = new Dev2FindMissingStrategyFactory(); IFindMissingStrategy strategy = fac.CreateFindMissingStrategy(enFindMissingType.StaticActivity); List<string> actual = strategy.GetActivityFields(activity); List<string> expected = new List<string> { "[[FileContents]]", "[[OutputPath]]", "[[Password]]", "[[Username]]","[[KeyFile]]", "[[Result]]" }; CollectionAssert.AreEqual(expected, actual); }
protected override void BuildDataList() { BuildShapeAndTestData(); var readtype = ScenarioContext.Current.Get<string>("method"); var overwrite = false; var appendTop = false; var appendBottom = false; switch(readtype) { case "Overwrite": overwrite = true; break; case "Append Top": appendTop = true; break; case "Append Bottom": appendBottom = true; break; } var fileWrite = new DsfFileWrite { Username = ScenarioContext.Current.Get<string>(CommonSteps.SourceUsernameHolder), Password = ScenarioContext.Current.Get<string>(CommonSteps.SourcePasswordHolder), Result = ScenarioContext.Current.Get<string>(CommonSteps.ResultVariableHolder), OutputPath = ScenarioContext.Current.Get<string>(CommonSteps.SourceHolder), Overwrite = overwrite, AppendTop = appendTop, AppendBottom = appendBottom, FileContents = ScenarioContext.Current.Get<string>("content") }; TestStartNode = new FlowStep { Action = fileWrite }; ScenarioContext.Current.Add("activity", fileWrite); }
public void DsfFileWrite_UpdateForEachOutputs_MoreThan1Updates_DoesNothing() { //------------Setup for test-------------------------- var newGuid = Guid.NewGuid(); const string result = "[[CompanyName]]"; var act = new DsfFileWrite { FileContents = string.Concat(TestContext.TestRunDirectory, "\\", newGuid + "[[CompanyName]].txt"), OutputPath = 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); }
public void DsfFileWrite_UpdateForEachOutputs_NullUpdates_DoesNothing() { //------------Setup for test-------------------------- var newGuid = Guid.NewGuid(); const string result = "[[CompanyName]]"; var act = new DsfFileWrite { FileContents = string.Concat(TestContext.TestRunDirectory, "\\", newGuid + "[[CompanyName]].txt"), OutputPath = string.Concat(TestContext.TestRunDirectory, "\\", newGuid + "[[CompanyName]]2.txt"), Result = result }; act.UpdateForEachOutputs(null); //------------Assert Results------------------------- Assert.AreEqual(result, act.Result); }
public void DsfFileWrite_GetForEachOutputs_WhenHasResult_ReturnsOutputList() { //------------Setup for test-------------------------- var newGuid = Guid.NewGuid(); const string result = "[[CompanyName]]"; var act = new DsfFileWrite { FileContents = string.Concat(TestContext.TestRunDirectory, "\\", newGuid + "[[CompanyName]].txt"), OutputPath = string.Concat(TestContext.TestRunDirectory, "\\", newGuid + "[[CompanyName]]2.txt"), Result = result }; //------------Execute Test--------------------------- var dsfForEachItems = act.GetForEachOutputs(); //------------Assert Results------------------------- Assert.AreEqual(1, dsfForEachItems.Count); Assert.AreEqual(result, dsfForEachItems[0].Name); Assert.AreEqual(result, dsfForEachItems[0].Value); }
public void DsfFileWrite_GetForEachInputs_WhenHasExpression_ReturnsInputList() { //------------Setup for test-------------------------- var newGuid = Guid.NewGuid(); var inputPath = string.Concat(TestContext.TestRunDirectory, "\\", newGuid + "[[CompanyName]].txt"); var outputPath = string.Concat(TestContext.TestRunDirectory, "\\", newGuid + "[[CompanyName]]2.txt"); var act = new DsfFileWrite { FileContents = inputPath, OutputPath = outputPath, Result = "[[CompanyName]]" }; //------------Execute Test--------------------------- var dsfForEachItems = act.GetForEachInputs(); //------------Assert Results------------------------- Assert.AreEqual(2, dsfForEachItems.Count); Assert.AreEqual(outputPath, dsfForEachItems[0].Name); Assert.AreEqual(outputPath, dsfForEachItems[0].Value); Assert.AreEqual(inputPath, dsfForEachItems[1].Name); Assert.AreEqual(inputPath, dsfForEachItems[1].Value); }