public void DsfCaseConvert_OnExecute_StarNotation_NoResultField_ReplacesExistingData() { //------------Setup for test-------------------------- // 27.08.2013 // NOTE : The result must remain [ as this is how the fliping studio generates the result when using (*) notation ;) // There is a proper bug in to fix this issue, but since the studio is spaghetti I will leave this to the experts ;) IList <ICaseConvertTO> convertCollection = new List <ICaseConvertTO> { CaseConverterFactory.CreateCaseConverterTO("[[testRecSet(*).field]]", "UPPER", "", 1) }; SetupArguments(ActivityStrings.CaseConvert_MixedRegionTypes_CurrentDL, ActivityStrings.CaseConvert_MixedRegionTypes_DLShape, convertCollection); //------------Execute Test--------------------------- IDSFDataObject result = ExecuteProcess(); string actualScalar; IList <string> actualRecset; string error; GetScalarValueFromEnvironment(result.Environment, "testVar", out actualScalar, out error); GetRecordSetFieldValueFromDataList(result.Environment, "testRecSet", "field", out actualRecset, out error); // remove test datalist ;) //------------Assert Results------------------------- const string expected = @"CHANGE THIS TO UPPER CASE"; Assert.AreEqual(expected, actualRecset[0]); }
public void CaseConvert_WithRecordSetDataAndStar_Expected_AllRecordsConverted() { IList <ICaseConvertTO> convertCollection = new List <ICaseConvertTO> { CaseConverterFactory.CreateCaseConverterTO("[[testRecSet(*).testVar]]", "Title Case", "[", 3) }; SetupArguments(@"<root><testRecSet><testVar>do not change this to first leter upper case</testVar></testRecSet><testRecSet><testVar>change this to first leter upper case</testVar></testRecSet></root>", ActivityStrings.CaseConvert_DLWithRecordSetShape, convertCollection); IDSFDataObject result = ExecuteProcess(); const string expected = @"Change This To First Leter Upper Case"; IList <IBinaryDataListItem> actual; string error; GetRecordSetFieldValueFromDataList(result.DataListID, "testRecSet", "testVar", out actual, out error); // This should be an index of 2 string actualValue = actual[1].TheValue; // remove test datalist ;) DataListRemoval(result.DataListID); Assert.AreEqual(@"Do Not Change This To First Leter Upper Case", actual[0].TheValue); Assert.AreEqual(expected, actualValue); }
public static IDev2TOFn CreateNewDTO(IDev2TOFn dto, int index = 0, bool inserted = false, string initializeWith = "") { IDev2TOFn toReturn = null; TypeSwitch.Do(dto, // ReSharper disable ImplicitlyCapturedClosure TypeSwitch.Case <ActivityDTO>(x => toReturn = new ActivityDTO(initializeWith, "", index, inserted)), // ReSharper restore ImplicitlyCapturedClosure TypeSwitch.Case <DataSplitDTO>(x => { var dataSplitDto = dto as DataSplitDTO; if (dataSplitDto != null) { toReturn = new DataSplitDTO(initializeWith, dataSplitDto.SplitType, dataSplitDto.At, index, false, inserted); } }), TypeSwitch.Case <DataMergeDTO>(x => { var dataMergeDto = dto as DataMergeDTO; if (dataMergeDto != null) { toReturn = new DataMergeDTO(initializeWith, dataMergeDto.MergeType, dataMergeDto.At, index, dataMergeDto.Padding, dataMergeDto.Alignment, inserted); } }), TypeSwitch.Case <CaseConvertTO>(x => { var caseConvertTO = dto as CaseConvertTO; if (caseConvertTO != null) { toReturn = CaseConverterFactory.CreateCaseConverterTO(initializeWith, caseConvertTO.ConvertType, caseConvertTO.Result, index); } }), TypeSwitch.Case <BaseConvertTO>(x => { var baseConvertTO = dto as BaseConvertTO; if (baseConvertTO != null) { toReturn = new BaseConvertTO(initializeWith, baseConvertTO.FromType, baseConvertTO.ToType, baseConvertTO.ToExpression, index, inserted); } }), // ReSharper disable ImplicitlyCapturedClosure TypeSwitch.Case <GatherSystemInformationTO>(x => toReturn = // ReSharper restore ImplicitlyCapturedClosure new GatherSystemInformationTO(enTypeOfSystemInformationToGather.FullDateTime, initializeWith, index, inserted)), // ReSharper disable ImplicitlyCapturedClosure TypeSwitch.Case <XPathDTO>(x => toReturn = new XPathDTO(initializeWith, "", index, inserted)), // ReSharper restore ImplicitlyCapturedClosure // ReSharper disable ImplicitlyCapturedClosure TypeSwitch.Case <FindRecordsTO>(() => toReturn = new FindRecordsTO("", "", index, inserted)), // ReSharper restore ImplicitlyCapturedClosure // ReSharper disable ImplicitlyCapturedClosure TypeSwitch.Default(() => toReturn = null)); // ReSharper restore ImplicitlyCapturedClosure return(toReturn); }
public static IDev2TOFn CreateNewDTO(IDev2TOFn dto, int index, bool inserted, string initializeWith) { IDev2TOFn toReturn = null; TypeSwitch.Do(dto, TypeSwitch.Case <ActivityDTO>(x => toReturn = new ActivityDTO(initializeWith, "", index, inserted)), TypeSwitch.Case <DataSplitDTO>(x => { if (dto is DataSplitDTO dataSplitDto) { toReturn = new DataSplitDTO(initializeWith, dataSplitDto.SplitType, dataSplitDto.At, index, false, inserted); } }), TypeSwitch.Case <DataMergeDTO>(x => { if (dto is DataMergeDTO dataMergeDto) { toReturn = new DataMergeDTO(initializeWith, dataMergeDto.MergeType, dataMergeDto.At, index, dataMergeDto.Padding, dataMergeDto.Alignment, inserted); } }), TypeSwitch.Case <CaseConvertTO>(x => { if (dto is CaseConvertTO caseConvertTO) { toReturn = CaseConverterFactory.CreateCaseConverterTO(initializeWith, caseConvertTO.ConvertType, caseConvertTO.Result, index); } }), TypeSwitch.Case <BaseConvertTO>(x => { if (dto is BaseConvertTO baseConvertTO) { toReturn = new BaseConvertTO(initializeWith, baseConvertTO.FromType, baseConvertTO.ToType, baseConvertTO.ToExpression, index, inserted); } }), TypeSwitch.Case <GatherSystemInformationTO>(x => toReturn = new GatherSystemInformationTO(enTypeOfSystemInformationToGather.FullDateTime, initializeWith, index, inserted)), TypeSwitch.Case <XPathDTO>(x => toReturn = new XPathDTO(initializeWith, "", index, inserted)), TypeSwitch.Case <FindRecordsTO>(() => toReturn = new FindRecordsTO("", "", index, inserted)), TypeSwitch.Case <DecisionTO>(() => toReturn = new DecisionTO(initializeWith, "", "", index, inserted)), TypeSwitch.Case <JsonMappingTo>(() => toReturn = new JsonMappingTo(initializeWith, index, inserted)), TypeSwitch.Case <SharepointSearchTo>(() => toReturn = new SharepointSearchTo(initializeWith, "=", "", index, inserted)), TypeSwitch.Case <SharepointReadListTo>(() => toReturn = new SharepointReadListTo("", initializeWith, "", "")), TypeSwitch.Case <AssignObjectDTO>(x => toReturn = new AssignObjectDTO(initializeWith, "", index, inserted)), TypeSwitch.Default(() => toReturn = null)); return(toReturn); }
public void CaseConvert_WithRecordSetDataWithInvalidIndex_Expected_Error() { IList <ICaseConvertTO> convertCollection = new List <ICaseConvertTO> { CaseConverterFactory.CreateCaseConverterTO("[[testRecSet(0+1).testVar]]", "Title Case", "[[testRecSet(0+1).testVar]]", 3) }; SetupArguments(@"<root><testRecSet><testVar>do not change this to first leter upper case</testVar></testRecSet><testRecSet><testVar>change this to first leter upper case</testVar></testRecSet></root>", ActivityStrings.CaseConvert_DLWithRecordSetShape, convertCollection); IDSFDataObject result = ExecuteProcess(); // remove test datalist ;) DataListRemoval(result.DataListID); Assert.IsTrue(Compiler.HasErrors(result.DataListID)); }
public void CaseConvert_FirstUpper_Expected_FirstLetterIsUpperCase() { IList <ICaseConvertTO> convertCollection = new List <ICaseConvertTO> { CaseConverterFactory.CreateCaseConverterTO("[[testVar]]", "Sentence", "[[testVar]]", 1) }; SetupArguments(@"<root><testVar>change this to first leter upper case</testVar></root>", ActivityStrings.CaseConvert_DLShape, convertCollection); var result = ExecuteProcess(); const string expected = @"Change this to first leter upper case"; GetScalarValueFromEnvironment(result.Environment, "testVar", out string actual, out string error); // remove test datalist ;) Assert.AreEqual(expected, actual); }
public void DsfCaseConvertActivity_GetOutputs_Called_ShouldReturnListWithResultValueInIt() { //------------Setup for test-------------------------- IList <ICaseConvertTO> convertCollection = new List <ICaseConvertTO> { CaseConverterFactory.CreateCaseConverterTO("[[testVar]]", "UPPER", "[[testVar]]", 1), CaseConverterFactory.CreateCaseConverterTO("[[testVar2]]", "UPPER", "[[testVar2]]", 1) }; var act = new DsfCaseConvertActivity { ConvertCollection = convertCollection }; //------------Execute Test--------------------------- var outputs = act.GetOutputs(); //------------Assert Results------------------------- Assert.AreEqual(2, outputs.Count); Assert.AreEqual("[[testVar]]", outputs[0]); Assert.AreEqual("[[testVar2]]", outputs[1]); }
public void CaseConvert_AllLower_Expected_AllLowerCase() { IList <ICaseConvertTO> convertCollection = new List <ICaseConvertTO> { CaseConverterFactory.CreateCaseConverterTO("[[testVar]]", "lower", "[[testVar]]", 1) }; SetupArguments(@"<root><testVar>CHANGE THIS TO LOWER CASE</testVar> </root>", ActivityStrings.CaseConvert_DLShape, convertCollection); var result = ExecuteProcess(); const string expected = @"change this to lower case"; GetScalarValueFromEnvironment(result.Environment, "testVar", out string actual, out string error); // remove test datalist ;) Assert.AreEqual(expected, actual); }
public CaseConvertDesignerViewModel(ModelItem modelItem) : base(modelItem) { AddTitleBarQuickVariableInputToggle(); AddTitleBarHelpToggle(); dynamic mi = ModelItem; InitializeItems(mi.ConvertCollection); if (mi.ConvertCollection == null || mi.ConvertCollection.Count <= 0) { mi.ConvertCollection.Add(CaseConverterFactory.CreateCaseConverterTO("", "UPPER", "", 1)); mi.ConvertCollection.Add(CaseConverterFactory.CreateCaseConverterTO("", "UPPER", "", 2)); } ItemsList = CaseConverter.ConvertTypes.ToObservableCollection(); }
public CaseConvertDesignerViewModel(ModelItem modelItem) : base(modelItem) { AddTitleBarQuickVariableInputToggle(); AddTitleBarLargeToggle(); dynamic mi = ModelItem; InitializeItems(mi.ConvertCollection); if (mi.ConvertCollection == null || mi.ConvertCollection.Count <= 0) { mi.ConvertCollection.Add(CaseConverterFactory.CreateCaseConverterTO("", "UPPER", "", 1)); mi.ConvertCollection.Add(CaseConverterFactory.CreateCaseConverterTO("", "UPPER", "", 2)); } ItemsList = CaseConverter.ConvertTypes.ToObservableCollection(); HelpText = Warewolf.Studio.Resources.Languages.HelpText.Tool_Data_Case_Convert; }
// Bug 8474 - Travis.Frisinger : Issue was a empty check, not language notation public void CaseConvert_BlankValue_Expected_BlankValue() { IList <ICaseConvertTO> convertCollection = new List <ICaseConvertTO> { CaseConverterFactory.CreateCaseConverterTO("[[testVar]]", "UPPER", "[[testVar]]", 1) }; SetupArguments(@"<root><testVar></testVar></root>", ActivityStrings.CaseConvert_DLShape, convertCollection); IDSFDataObject result = ExecuteProcess(); const string expected = @""; string actual; string error; GetScalarValueFromEnvironment(result.Environment, "testVar", out actual, out error); // remove test datalist ;) Assert.AreEqual(expected, actual); }
public void CaseConvert_No_Result_Variable_Expected_AllFirstLettersIsUpperCase() { IList <ICaseConvertTO> convertCollection = new List <ICaseConvertTO> { CaseConverterFactory.CreateCaseConverterTO("[[testVar]]", "Title Case", "", 1) }; SetupArguments(@"<root><testVar>change this to first leter upper case</testVar></root>", ActivityStrings.CaseConvert_DLShape, convertCollection); IDSFDataObject result = ExecuteProcess(); const string expected = @"Change This To First Leter Upper Case"; string actual; string error; GetScalarValueFromEnvironment(result.Environment, "testVar", out actual, out error); // remove test datalist ;) Assert.AreEqual(expected, actual); }
public void CaseConvertWithAllUpperAndMultipleRegionsExpectedAllUpperCase() { IList <ICaseConvertTO> convertCollection = new List <ICaseConvertTO> { CaseConverterFactory.CreateCaseConverterTO("[[testRecSet().field]], [[testVar]]", "UPPER", "[[testRecSet().field]], [[testVar]]", 1) }; SetupArguments(ActivityStrings.CaseConvert_MixedRegionTypes_CurrentDL, ActivityStrings.CaseConvert_MixedRegionTypes_DLShape, convertCollection); var result = ExecuteProcess(); GetScalarValueFromEnvironment(result.Environment, "testVar", out string actualScalar, out string error); GetRecordSetFieldValueFromDataList(result.Environment, "testRecSet", "field", out IList <string> actualRecset, out error); const string expected = @"CHANGE THIS TO UPPER CASE"; // remove test datalist ;) Assert.AreEqual(expected, actualScalar); Assert.AreEqual(expected, actualRecset[1]); }
public void CaseConvert_Evaluate_WhenRecursiveRegion_ExpectSingleWellFormedRegionAsResult() { //------------Setup for test-------------------------- IList <ICaseConvertTO> convertCollection = new List <ICaseConvertTO> { CaseConverterFactory.CreateCaseConverterTO("[[[[testVar]]]]", "UPPER", "[[[[testVar]]]]", 1) }; SetupArguments(@"<root><NewVar>change this to upper case</NewVar><testVar>NewVar</testVar></root>", ActivityStrings.CaseConvert_DLShape, convertCollection); //------------Execute Test--------------------------- var result = ExecuteProcess(); GetScalarValueFromEnvironment(result.Environment, "NewVar", out string actual, out string error); //------------Assert Results------------------------- const string expected = @"CHANGE THIS TO UPPER CASE"; Assert.AreEqual(expected, actual); }
public void CaseConvert_Execute_InvalidVariable_Expected_Error() { IList <ICaseConvertTO> convertCollection = new List <ICaseConvertTO> { CaseConverterFactory.CreateCaseConverterTO("[rec().a]]", "Title Case", "", 1) }; SetupArguments(@"<root><testVar>change this 5435123130t lete2435r upper case</testVar></root>", ActivityStrings.CaseConvert_DLShape, convertCollection); IDSFDataObject result = ExecuteProcess(); string actual; string error; GetScalarValueFromDataList(result.DataListID, "testVar", out actual, out error); // remove test datalist ;) DataListRemoval(result.DataListID); Assert.IsTrue(Compiler.HasErrors(result.DataListID)); }
public void DsfCaseConvert_Execute_MultipleVariablesinResults_ExpectError() { IList <ICaseConvertTO> convertCollection = new List <ICaseConvertTO> { CaseConverterFactory.CreateCaseConverterTO("[[testVar]]", "UPPER", "[[testVar]][[b]]", 1) }; SetupArguments(@"<root><testVar>change this to upper case</testVar></root>", ActivityStrings.CaseConvert_DLShape, convertCollection); IDSFDataObject result = ExecuteProcess(); string actual; string error; GetScalarValueFromDataList(result.DataListID, "testVar", out actual, out error); // remove test datalist ;) DataListRemoval(result.DataListID); Assert.IsTrue(Compiler.HasErrors(result.DataListID)); }
public void CaseConvert_WithRecordSetDataAndEmptyIndex_Expected_LastRecordCaseConverted() { IList <ICaseConvertTO> convertCollection = new List <ICaseConvertTO> { CaseConverterFactory.CreateCaseConverterTO("[[testRecSet(2).testVar]]", "Title Case", "[[testRecSet().testVar]]", 3) }; SetupArguments(@"<root><testRecSet><testVar>do not change this to first leter upper case</testVar></testRecSet><testRecSet><testVar>change this to first leter upper case</testVar></testRecSet></root>", ActivityStrings.CaseConvert_DLWithRecordSetShape, convertCollection); var result = ExecuteProcess(); const string expected = @"Change This To First Leter Upper Case"; GetRecordSetFieldValueFromDataList(result.Environment, "testRecSet", "testVar", out IList <string> actual, out string error); var actualValue = actual[1]; // remove test datalist ;) Assert.AreEqual(expected, actualValue); }
public void CaseConvert_AllUpper_Expected_AllUpperCase() { IList <ICaseConvertTO> convertCollection = new List <ICaseConvertTO> { CaseConverterFactory.CreateCaseConverterTO("[[testVar]]", "UPPER", "[[testVar]]", 1) }; SetupArguments(@"<root><testVar>change this to upper case</testVar></root>", ActivityStrings.CaseConvert_DLShape, convertCollection); IDSFDataObject result = ExecuteProcess(); string actual; string error; GetScalarValueFromDataList(result.DataListID, "testVar", out actual, out error); const string expected = @"CHANGE THIS TO UPPER CASE"; // remove test datalist ;) DataListRemoval(result.DataListID); Assert.AreEqual(expected, actual); }
public void CaseConvert_Blank_StringToConvert_Expected_AllFirstLettersIsUpperCase() { IList <ICaseConvertTO> convertCollection = new List <ICaseConvertTO> { CaseConverterFactory.CreateCaseConverterTO("", "Title Case", "", 1) }; SetupArguments(@"<root><testVar>change this 5435123130t lete2435r upper case</testVar></root>", ActivityStrings.CaseConvert_DLShape, convertCollection); IDSFDataObject result = ExecuteProcess(); const string expected = @"change this 5435123130t lete2435r upper case"; string actual; string error; GetScalarValueFromDataList(result.DataListID, "testVar", out actual, out error); // remove test datalist ;) DataListRemoval(result.DataListID); Assert.AreEqual(expected, actual); }
public void CaseConvertWithAllUpperAndMultipleRegionsInStringToConvertWithSingleOutputTargetExpectedOneUpperCase() { IList <ICaseConvertTO> convertCollection = new List <ICaseConvertTO> { CaseConverterFactory.CreateCaseConverterTO("[[testRecSet().field]], [[testVar]]", "UPPER", "[[testRecSet().field]]", 1) }; SetupArguments(ActivityStrings.CaseConvert_MixedRegionTypes_CurrentDL, ActivityStrings.CaseConvert_MixedRegionTypes_DLShape, convertCollection); IDSFDataObject result = ExecuteProcess(); string actualScalar; IList <string> actualRecset; string error; GetScalarValueFromEnvironment(result.Environment, "testVar", out actualScalar, out error); GetRecordSetFieldValueFromDataList(result.Environment, "testRecSet", "field", out actualRecset, out error); // remove test datalist ;) const string expected = @"CHANGE THIS TO UPPER CASE"; StringAssert.Contains(actualRecset[1], expected); StringAssert.Contains(actualScalar, expected); }