protected override void BuildDataList() { BuildShapeAndTestData(); scenarioContext.TryGetValue(CommonSteps.DestinationPrivateKeyFile, out string privateKeyFile); var create = new DsfPathCreate { OutputPath = scenarioContext.Get <string>(CommonSteps.DestinationHolder), Username = scenarioContext.Get <string>(CommonSteps.DestinationUsernameHolder).ResolveDomain(), Password = scenarioContext.Get <string>(CommonSteps.DestinationPasswordHolder), Overwrite = scenarioContext.Get <bool>(CommonSteps.OverwriteHolder), Result = scenarioContext.Get <string>(CommonSteps.ResultVariableHolder), PrivateKeyFile = privateKeyFile }; TestStartNode = new FlowStep { Action = create }; scenarioContext.Add("activity", create); }
public void Overwrite_Same_Object_Is_Equal() { //---------------Set up test pack------------------- var uniqueId = Guid.NewGuid().ToString(); var dsfPathCreate = new DsfPathCreate() { UniqueID = uniqueId, Result = "A" }; var pathCreate = new DsfPathCreate() { UniqueID = uniqueId, Result = "A" }; //---------------Assert Precondition---------------- Assert.IsTrue(dsfPathCreate.Equals(pathCreate)); //---------------Execute Test ---------------------- dsfPathCreate.Overwrite = true; pathCreate.Overwrite = true; var @equals = dsfPathCreate.Equals(pathCreate); //---------------Test Result ----------------------- Assert.IsTrue(@equals); }
public void GivenContainsAnCreateAs(string parentName, string activityName, Table table) { var activity = new DsfPathCreate { DisplayName = activityName }; foreach (var tableRow in table.Rows) { var variable = tableRow["File or Folder"]; var exist = tableRow["If it exits"]; var userName = tableRow["Username"]; var password = tableRow["Password"]; var result = tableRow["Result"]; activity.Result = result; activity.Username = userName; activity.Password = password; activity.Overwrite = exist == "True"; activity.OutputPath = variable; _commonSteps.AddVariableToVariableList(result); } _commonSteps.AddActivityToActivityList(parentName, activityName, activity); }
public void DsfPathCreate_GetState_ReturnsStateVariable() { //---------------Set up test pack------------------- //------------Setup for test-------------------------- var act = new DsfPathCreate { OutputPath = "[[OutputPath]]", Overwrite = false, Username = "******", PrivateKeyFile = "abcde", Result = "[[res]]" }; //------------Execute Test--------------------------- var stateItems = act.GetState(); Assert.AreEqual(5, stateItems.Count()); var expectedResults = new[] { new StateVariable { Name = "OutputPath", Type = StateVariable.StateType.Output, Value = "[[OutputPath]]" }, new StateVariable { Name = "Overwrite", Type = StateVariable.StateType.Input, Value = "False" }, new StateVariable { Name = "Username", Type = StateVariable.StateType.Input, Value = "Bob" }, new StateVariable { Name = "PrivateKeyFile", Type = StateVariable.StateType.Input, Value = "abcde" }, new StateVariable { Name = "Result", Type = StateVariable.StateType.Output, Value = "[[res]]" } }; var iter = act.GetState().Select( (item, index) => new { value = item, expectValue = expectedResults[index] } ); //------------Assert Results------------------------- foreach (var entry in iter) { Assert.AreEqual(entry.expectValue.Name, entry.value.Name); Assert.AreEqual(entry.expectValue.Type, entry.value.Type); Assert.AreEqual(entry.expectValue.Value, entry.value.Value); } }