public void SerializeToXML_ValidXML_Expect_Sucess() { ErrorResultTO errors; string error; IDataListTranslator xmlConverter = Dls.GetTranslator(XmlFormat); byte[] data = (TestHelper.ConvertStringToByteArray(DataListWellformedData)); IBinaryDataList obj = xmlConverter.ConvertTo(data, _dataListWellformed, out errors); IBinaryDataListEntry entry; if (obj.TryGetEntry("rs1", out entry, out error)) { IList <IBinaryDataListItem> cols = entry.FetchRecordAt(1, out error); int systemTagCount = Enum.GetValues(typeof(enSystemTag)).Length; var res1 = obj.FetchAllEntries().Count; var res2 = obj.FetchScalarEntries().Count; var res3 = obj.FetchRecordsetEntries().Count; var res4 = cols.Count; Assert.AreEqual(3 + systemTagCount, res1); Assert.AreEqual(2 + systemTagCount, res2); Assert.AreEqual(1, res3); Assert.AreEqual(2, res4); } else { Assert.Fail("Error"); } }
/// <summary> /// Converts a binary data list to list a data list item view models. /// </summary> /// <param name="dataListToConvert">The data list to convert.</param> /// <param name="errorString">The error string.</param> /// <returns></returns> private void ConvertBinaryDataListToListOfIDataListItemModels(IBinaryDataList dataListToConvert, out string errorString) { errorString = string.Empty; RecsetCollection = new OptomizedObservableCollection <IDataListItemModel>(); ScalarCollection = new OptomizedObservableCollection <IDataListItemModel>(); IList <IBinaryDataListEntry> listOfEntries = dataListToConvert.FetchAllEntries(); foreach (IBinaryDataListEntry entry in listOfEntries) { if (entry.IsRecordset) { IDataListItemModel recset = DataListItemModelFactory.CreateDataListModel(entry.Namespace, entry.Description, entry.ColumnIODirection); recset.IsEditable = entry.IsEditable; Validator.Add(recset); foreach (Dev2Column col in entry.Columns) { IDataListItemModel child = DataListItemModelFactory.CreateDataListModel(col.ColumnName, col.ColumnDescription, col.ColumnIODirection); child.Parent = recset; child.IsEditable = col.IsEditable; recset.Children.Add(child); recset.Validator.Add(child); } RecsetCollection.Add(recset); } else { IDataListItemModel scalar = DataListItemModelFactory.CreateDataListModel(entry.Namespace, entry.Description, entry.ColumnIODirection); scalar.IsEditable = entry.IsEditable; ScalarCollection.Add(scalar); Validator.Add(scalar); } } }
public void Can_Create_BinaryDataList_With_Blank_IsEditable_Blank_Expected_All_IsEditable_Properties_Are_True() { ErrorResultTO errors; var shape = new StringBuilder(@"<DataList><recset Description="""" ColumnIODirection=""Both"" ><f1 Description="""" ColumnIODirection=""Both"" /><f2 Description="""" ColumnIODirection=""Both"" /><f3 Description="""" ColumnIODirection=""Both"" /><f4 Description="""" ColumnIODirection=""Both"" /><f5 Description="""" ColumnIODirection=""Both"" /></recset><myScalar Description="""" ColumnIODirection=""Both"" /></DataList>"); Guid tmp = _compiler.ConvertTo(DataListFormat.CreateFormat(GlobalConstants._Studio_XML), shape, shape, out errors); IBinaryDataList bdl = _compiler.FetchBinaryDataList(tmp, out errors); _compiler.DeleteDataListByID(tmp); foreach (IBinaryDataListEntry entry in bdl.FetchAllEntries()) { if (entry.IsRecordset) { Assert.AreEqual(true, entry.IsEditable); foreach (Dev2Column c in entry.Columns) { Assert.AreEqual(true, c.IsEditable); } } else { Assert.AreEqual(true, entry.IsEditable); } } _compiler.ForceDeleteDataListByID(tmp); }
public void Can_Create_BinaryDataList_With_No_ColumnDirection() { ErrorResultTO errors; var shape = new StringBuilder(@"<DataList><recset Description="""" IsEditable=""True"" ><f1 Description="""" IsEditable=""True"" /><f2 Description="""" IsEditable=""True"" /><f3 Description="""" IsEditable=""True"" /><f4 Description="""" IsEditable=""True"" /><f5 Description="""" IsEditable=""True"" /></recset><myScalar Description="""" IsEditable=""True"" /></DataList>"); Guid tmp = _compiler.ConvertTo(DataListFormat.CreateFormat(GlobalConstants._Studio_XML), string.Empty.ToStringBuilder(), shape, out errors); IBinaryDataList bdl = _compiler.FetchBinaryDataList(tmp, out errors); _compiler.DeleteDataListByID(tmp); foreach (IBinaryDataListEntry entry in bdl.FetchAllEntries()) { if (entry.IsRecordset) { Assert.AreEqual(enDev2ColumnArgumentDirection.None, entry.ColumnIODirection); foreach (Dev2Column c in entry.Columns) { Assert.AreEqual(enDev2ColumnArgumentDirection.None, c.ColumnIODirection); } } else { Assert.AreEqual(enDev2ColumnArgumentDirection.None, entry.ColumnIODirection); } } _compiler.ForceDeleteDataListByID(tmp); }
public void PathCopyActivity_GetInputs_Expected_Six_Input() { DsfPathCopy testAct = new DsfPathCopy(); IBinaryDataList inputs = testAct.GetInputs(); Assert.IsTrue(inputs.FetchAllEntries().Count == 8); }
public void ZipActivity_GetOutputs_Expected_One_Output() { DsfZip testAct = new DsfZip(); IBinaryDataList outputs = testAct.GetOutputs(); Assert.IsTrue(outputs.FetchAllEntries().Count == 1); }
public void ZipActivity_GetInputs_Expected_Eight_Input() { DsfZip testAct = new DsfZip(); IBinaryDataList inputs = testAct.GetInputs(); Assert.IsTrue(inputs.FetchAllEntries().Count == 11); }
public void PathCreateActivity_GetInputs_Expected_Five_Input() { DsfPathCreate testAct = new DsfPathCreate(); IBinaryDataList inputs = testAct.GetInputs(); // remove test datalist ;) Assert.AreEqual(5, inputs.FetchAllEntries().Count); }
public void DeleteRecordActivity_GetInputs_Expected_One_Input() { DsfCountRecordsetActivity testAct = new DsfCountRecordsetActivity(); IBinaryDataList inputs = testAct.GetInputs(); // remove test datalist ;) Assert.AreEqual(1, inputs.FetchAllEntries().Count); }
public void FileReadActivity_GetOutputs_Expected_One_Output() { DsfFileRead testAct = new DsfFileRead(); IBinaryDataList outputs = testAct.GetOutputs(); // remove test datalist ;) Assert.AreEqual(1, outputs.FetchAllEntries().Count); }
// ReSharper disable InconsistentNaming public void GetGeneralSettingsFromActivityAbstract_Expected_SettingsReturned() // ReSharper restore InconsistentNaming { DsfCountRecordsetActivity testAct = new DsfCountRecordsetActivity { IsSimulationEnabled = false }; IBinaryDataList testDl = testAct.GetGeneralSettingData(); Assert.AreEqual(1, testDl.FetchAllEntries().Count); }
public void IndexActivity_GetOutputs_Expected_One_Output() { DsfIndexActivity testAct = new DsfIndexActivity(); IBinaryDataList outputs = testAct.GetOutputs(); // remove test datalist ;) DataListRemoval(outputs.UID); Assert.AreEqual(1, outputs.FetchAllEntries().Count); }
// ReSharper disable InconsistentNaming public void FileReadActivity_GetInputs_Expected_Four_Input() // ReSharper restore InconsistentNaming { DsfFileRead testAct = new DsfFileRead(); IBinaryDataList inputs = testAct.GetInputs(); // remove test datalist ;) Assert.AreEqual(4, inputs.FetchAllEntries().Count); }
public void IndexActivity_GetInputs_Expected_Five_Input() { DsfIndexActivity testAct = new DsfIndexActivity(); IBinaryDataList inputs = testAct.GetInputs(); // remove test datalist ;) DataListRemoval(inputs.UID); Assert.AreEqual(6, inputs.FetchAllEntries().Count); }
public void SortRecords_GetOutputs_Expected_Zero_Output() { DsfSortRecordsActivity testAct = new DsfSortRecordsActivity(); IBinaryDataList outputs = testAct.GetOutputs(); var res = outputs.FetchAllEntries().Count; // remove test datalist ;) Assert.AreEqual(0, res); }
public void CountRecordsetActivity_GetOutputs_Expected_One_Output() { DsfCountRecordsetActivity testAct = new DsfCountRecordsetActivity(); IBinaryDataList outputs = testAct.GetOutputs(); var result = outputs.FetchAllEntries().Count; // remove test datalist ;) Assert.AreEqual(1, result); }
public DataListTranslatedPayloadTO ConvertFrom(IBinaryDataList payload, out ErrorResultTO errors) { if (payload == null) { throw new ArgumentNullException("payload"); } StringBuilder result = new StringBuilder("<" + RootTag + ">"); errors = new ErrorResultTO(); var entries = payload.FetchAllEntries(); foreach (var entry in entries) { if (entry.IsRecordset) { AddEntryToBuilder(result, entry); result.Append(">"); foreach (var col in entry.Columns) { result.Append("<"); result.Append(col.ColumnName); result.Append(" " + Description + "=\""); result.Append(col.ColumnDescription); result.Append("\" "); result.Append(IsEditable + "=\""); result.Append(col.IsEditable); result.Append("\" "); // Travis.Frisinger - Added Column direction result.Append(GlobalConstants.DataListIoColDirection + "=\""); result.Append(col.ColumnIODirection); result.Append("\" "); result.Append("/>"); } result.Append("</"); result.Append(entry.Namespace); result.Append(">"); } else { AddEntryToBuilder(result, entry); result.Append("/>"); } } result.Append("</" + RootTag + ">"); DataListTranslatedPayloadTO tmp = new DataListTranslatedPayloadTO(result.ToString()); return(tmp); }
public void CountRecordsetActivity_GetInputs_Expected_Four_Input() { DsfReplaceActivity testAct = new DsfReplaceActivity(); IBinaryDataList inputs = testAct.GetInputs(); var res = inputs.FetchAllEntries().Count; // remove test datalist ;) Assert.AreEqual(4, res); }
public void PathRenameActivity_GetOutputs_Expected_One_Output() { DsfPathRename testAct = new DsfPathRename(); IBinaryDataList outputs = testAct.GetOutputs(); var res = outputs.FetchAllEntries().Count; // remove test datalist ;) Assert.AreEqual(1, res); }
public void PathMoveActivity_GetInputs_Expected_Six_Input() { DsfPathMove testAct = new DsfPathMove(); IBinaryDataList inputs = testAct.GetInputs(); var res = inputs.FetchAllEntries().Count; // remove test datalist ;) Assert.AreEqual(8, res); }
public void UnZipActivity_GetInputs_Expected_Seven_Input() { DsfUnZip testAct = new DsfUnZip(); IBinaryDataList inputs = testAct.GetInputs(); var res = inputs.FetchAllEntries().Count; // remove test datalist ;) Assert.AreEqual(9, res); }
public void DateTimeActivity_GetOutputs_Expected_One_Output() { DsfDateTimeActivity testAct = new DsfDateTimeActivity { DateTime = "27-10-2012", InputFormat = "DD-mm-yyyy", TimeModifierType = "Days", TimeModifierAmount = 5, TimeModifierAmountDisplay = "5", OutputFormat = "DD-mm-yyyy", Result = "[[result]]" }; IBinaryDataList outputs = testAct.GetOutputs(); // remove test datalist ;) Assert.AreEqual(1, outputs.FetchAllEntries().Count); }
public void DateTimeDifference_GetOutputs_Expected_One_Output() { DsfDateTimeDifferenceActivity testAct = new DsfDateTimeDifferenceActivity { Input1 = "27-10-2012", Input2 = "28-10-2012", InputFormat = "dd-mm-yyyy", OutputType = "Years", Result = "[[result]]" }; IBinaryDataList outputs = testAct.GetOutputs(); // remove test datalist ;) Assert.AreEqual(1, outputs.FetchAllEntries().Count); }
// ReSharper disable InconsistentNaming public void FileWriteActivity_GetInputs_Expected_Seven_Input() // ReSharper restore InconsistentNaming { DsfFileWrite testAct = new DsfFileWrite(); IBinaryDataList inputs = testAct.GetInputs(); // remove test datalist ;) DataListRemoval(inputs.UID); Assert.AreEqual(9, inputs.FetchAllEntries().Count); }
public void RecordsetLengthRecordsetActivity_GetInputs_Expected_One_Input() { DsfRecordsetLengthActivity testAct = new DsfRecordsetLengthActivity(); IBinaryDataList inputs = testAct.GetInputs(); var result = inputs.FetchAllEntries().Count; // remove test datalist ;) Assert.AreEqual(1, result); }
public DataListTranslatedPayloadTO ConvertFrom(IBinaryDataList payload, out ErrorResultTO errors) { if(payload == null) { throw new ArgumentNullException("payload"); } StringBuilder result = new StringBuilder("<" + RootTag + ">"); errors = new ErrorResultTO(); var entries = payload.FetchAllEntries(); foreach(var entry in entries) { if(entry.IsRecordset) { AddEntryToBuilder(result, entry); result.Append(">"); foreach(var col in entry.Columns) { result.Append("<"); result.Append(col.ColumnName); result.Append(" " + Description + "=\""); result.Append(col.ColumnDescription); result.Append("\" "); result.Append(IsEditable + "=\""); result.Append(col.IsEditable); result.Append("\" "); // Travis.Frisinger - Added Column direction result.Append(GlobalConstants.DataListIoColDirection + "=\""); result.Append(col.ColumnIODirection); result.Append("\" "); result.Append("/>"); } result.Append("</"); result.Append(entry.Namespace); result.Append(">"); } else { AddEntryToBuilder(result, entry); result.Append("/>"); } } result.Append("</" + RootTag + ">"); DataListTranslatedPayloadTO tmp = new DataListTranslatedPayloadTO(result.ToString()); return tmp; }
public void UnZipActivity_GetOutputs_Expected_One_Output() { DsfUnZip testAct = new DsfUnZip(); IBinaryDataList outputs = testAct.GetOutputs(); var res = outputs.FetchAllEntries().Count; // remove test datalist ;) DataListRemoval(outputs.UID); Assert.AreEqual(1, res); }
public void PathDeleteActivity_GetInputs_Expected_Four_Input() { DsfPathDelete testAct = new DsfPathDelete(); IBinaryDataList inputs = testAct.GetInputs(); var res = inputs.FetchAllEntries().Count; // remove test datalist ;) DataListRemoval(inputs.UID); Assert.AreEqual(4, res); }
public void SortRecords_GetInputs_Expected_Two_Input() { DsfSortRecordsActivity testAct = new DsfSortRecordsActivity(); IBinaryDataList inputs = testAct.GetInputs(); var res = inputs.FetchAllEntries().Count; // remove test datalist ;) DataListRemoval(inputs.UID); Assert.AreEqual(2, res); }
// ReSharper disable InconsistentNaming public void FolderReadActivity_GetInputs_Expected_Four_Input() // ReSharper restore InconsistentNaming { DsfFolderRead testAct = new DsfFolderRead(); IBinaryDataList inputs = testAct.GetInputs(); var res = inputs.FetchAllEntries().Count; // remove test datalist ;) DataListRemoval(inputs.UID); Assert.AreEqual(7, res); }
/// <summary> /// Gets the wizard data list for a workflow. /// </summary> /// <param name="dataList"></param> /// <returns> /// The string for the data list /// </returns> /// <exception cref="System.Exception"> /// </exception> public string GetWizardDataListForWorkflow(string dataList) { IBinaryDataList newDl = Dev2BinaryDataListFactory.CreateDataList(); ErrorResultTO errors; var dataListStringBuilder = new StringBuilder(dataList); Guid dlID = ConvertTo(DataListFormat.CreateFormat(GlobalConstants._XML_Without_SystemTags), dataListStringBuilder, dataListStringBuilder, out errors); if (!errors.HasErrors()) { IBinaryDataList dl = FetchBinaryDataList(dlID, out errors); if (!errors.HasErrors()) { IList <IBinaryDataListEntry> entries = dl.FetchAllEntries(); foreach (IBinaryDataListEntry entry in entries) { if (entry.IsRecordset) { if (entry.ColumnIODirection != enDev2ColumnArgumentDirection.None) { string tmpError; newDl.TryCreateRecordsetTemplate(entry.Namespace, entry.Description, entry.Columns, true, out tmpError); } } else { if (entry.ColumnIODirection != enDev2ColumnArgumentDirection.None) { string tmpError; IBinaryDataListItem scalar = entry.FetchScalar(); newDl.TryCreateScalarTemplate(string.Empty, scalar.FieldName, entry.Description, true, out tmpError); } } } Guid newDlId = PushBinaryDataList(newDl.UID, newDl, out errors); dataList = ConvertFrom(newDlId, DataListFormat.CreateFormat(GlobalConstants._XML_Without_SystemTags), enTranslationDepth.Shape, out errors).ToString(); } else { throw new Exception(errors.MakeUserReady()); } } else { throw new Exception(errors.MakeUserReady()); } return(dataList); }
/// <summary> /// Converts a binary data list to list a data list item view models. /// </summary> /// <param name="dataListToConvert">The data list to convert.</param> /// <param name="errorString">The error string.</param> /// <returns></returns> private void ConvertBinaryDataListToListOfIDataListItemModels(IBinaryDataList dataListToConvert, out string errorString) { errorString = string.Empty; RecsetCollection.Clear(); ScalarCollection.Clear(); IList<IBinaryDataListEntry> listOfEntries = dataListToConvert.FetchAllEntries(); foreach(var entry in listOfEntries) { if(entry.IsRecordset) { var recset = DataListItemModelFactory.CreateDataListModel(entry.Namespace, entry.Description, entry.ColumnIODirection); recset.IsEditable = entry.IsEditable; foreach(var col in entry.Columns) { var child = DataListItemModelFactory.CreateDataListModel(col.ColumnName, col.ColumnDescription, col.ColumnIODirection); child.Parent = recset; child.IsEditable = col.IsEditable; recset.Children.Add(child); } RecsetCollection.Add(recset); } else { var scalar = DataListItemModelFactory.CreateDataListModel(entry.Namespace, entry.Description, entry.ColumnIODirection); scalar.IsEditable = entry.IsEditable; ScalarCollection.Add(scalar); } } }