public void AllLower_Simple_String_Expected_All_LowerCase() { IBinaryDataListItem item = Dev2BinaryDataListFactory.CreateBinaryItem("STRING TO MAKE LOWERCASE", ""); IBinaryDataListItem result = converter.TryConvert("lower", item); Assert.AreEqual("string to make lowercase", result.TheValue); }
public static ActivityUpsertTO CreateEntriesFromOutputTOs(IList <OutputTO> outputToList, IDataListCompiler compiler, Guid dlId, out ErrorResultTO errors) { errors = new ErrorResultTO(); ActivityUpsertTO result = new ActivityUpsertTO(); foreach (OutputTO outputTo in outputToList) { // I first need to detect if the entry is a recordset!!!!!!!!!!! // Then if scalar upsert scalar else upsert a recordset-- how was this to ever work?!?! // Break into parts so we can correctly create the required entry...... IBinaryDataListEntry entry = Dev2BinaryDataListFactory.CreateEntry(RecsetName, string.Empty, dlId); int idx = 1; foreach (string output in outputTo.OutputStrings) { IBinaryDataListItem itemToAdd = Dev2BinaryDataListFactory.CreateBinaryItem(output, RecsetName, FieldName, idx); idx++; string error; entry.TryAppendRecordItem(itemToAdd, out error); if (error != string.Empty) { errors.AddError(error); } } // push entry one time, no looping ;) result.AddEntry(entry, outputTo.OutPutDescription); } return(result); }
private void GenerateRequestDictionaryFromDataObject(out ErrorResultTO errors) { var compiler = DataListFactory.CreateDataListCompiler(); errors = new ErrorResultTO(); ErrorResultTO invokeErrors; IBinaryDataList bdl = compiler.FetchBinaryDataList(DataObject.DataListID, out invokeErrors); errors.MergeErrors(invokeErrors); if (!invokeErrors.HasErrors()) { foreach (IBinaryDataListEntry entry in bdl.FetchScalarEntries()) { IBinaryDataListItem itm = entry.FetchScalar(); if (!DataListUtil.IsSystemTag(itm.FieldName)) { var stringBuilder = new StringBuilder(""); try { stringBuilder = new StringBuilder(itm.TheValue); } // ReSharper disable EmptyGeneralCatchClause catch (Exception) // ReSharper restore EmptyGeneralCatchClause { } Request.AddArgument(itm.FieldName, stringBuilder); } } } }
public void AllLower_StringContainingNumerics_Expected_All_LowerCase() { IBinaryDataListItem item = Dev2BinaryDataListFactory.CreateBinaryItem("2STRING T4O M6AKE LO08WERCASE", ""); IBinaryDataListItem result = converter.TryConvert("lower", item); Assert.AreEqual("2string t4o m6ake lo08wercase", result.TheValue); }
public IBinaryDataListItem TryConvert(string conversionType, IBinaryDataListItem item) { Func <string, string> returnedFunc; IBinaryDataListItem result = Dev2BinaryDataListFactory.CreateBinaryItem("Error Invalid Conversion Type", GlobalConstants.EvalautionScalar); if (_convertFunctions.TryGetValue(conversionType, out returnedFunc)) { if (returnedFunc != null) { string tmp = returnedFunc.Invoke(item.TheValue); if (item.Namespace != string.Empty) { result = Dev2BinaryDataListFactory.CreateBinaryItem(tmp, item.Namespace, item.FieldName, item.ItemCollectionIndex); } else { result = Dev2BinaryDataListFactory.CreateBinaryItem(tmp, item.FieldName); } } } return(result); }
public void AllUpper_StringContainingNumerics_Expected_All_UpperCase() { IBinaryDataListItem item = Dev2BinaryDataListFactory.CreateBinaryItem("2strinG 4To 8m9ake upp522erc7ase", ""); IBinaryDataListItem result = converter.TryConvert("UPPER", item); Assert.AreEqual("2STRING 4TO 8M9AKE UPP522ERC7ASE", result.TheValue); }
public void TitleCase_Complex_String_Expected_All_FirstLetterUpperCaseOnAll() { IBinaryDataListItem item = Dev2BinaryDataListFactory.CreateBinaryItem("make.(first)@ 'letter'//cap", ""); IBinaryDataListItem result = converter.TryConvert("Title Case", item); Assert.AreEqual("Make.(First)@ 'Letter'//Cap", result.TheValue); }
public void TitleCase_Simple_String_All_Caps_Expected_All_FirstLetterUpperCaseOnAll() { IBinaryDataListItem item = Dev2BinaryDataListFactory.CreateBinaryItem("MAKE FIRST LETTER UPPERCASE", ""); IBinaryDataListItem result = converter.TryConvert("Title Case", item); Assert.AreEqual("MAKE FIRST LETTER UPPERCASE", result.TheValue); }
public void TitleCase_StringWithNumeric_Expected_All_FirstLetterUpperCaseOnAll() { IBinaryDataListItem item = Dev2BinaryDataListFactory.CreateBinaryItem("1make fi5rst le6tter up3percase", ""); IBinaryDataListItem result = converter.TryConvert("Title Case", item); Assert.AreEqual("1make Fi5rst Le6tter Up3percase", result.TheValue); }
public void UpperFirst_Simple_String_Expected_All_FirstLetterUpperCase() { IBinaryDataListItem item = Dev2BinaryDataListFactory.CreateBinaryItem("make first letter uppercase", ""); IBinaryDataListItem result = converter.TryConvert("Sentence", item); Assert.AreEqual("Make first letter uppercase", result.TheValue); }
public void UpperFirst_StringContainingNumerics_Expected_All_FirstLetterUpperCase() { IBinaryDataListItem item = Dev2BinaryDataListFactory.CreateBinaryItem("5make1 1first 3letter up5percase", ""); IBinaryDataListItem result = converter.TryConvert("Sentence", item); Assert.AreEqual("5make1 1first 3letter up5percase", result.TheValue); }
public bool GetScalarValueFromDataList(Guid dataListId, string fieldToRetrieve, out string result, out string error) { ErrorResultTO errorResult; IBinaryDataListEntry entry; bool fine = Compiler.FetchBinaryDataList(dataListId, out errorResult).TryGetEntry(fieldToRetrieve, out entry, out error); if (entry != null && fine) { IBinaryDataListItem item = entry.FetchScalar(); try { result = item.TheValue; } catch (NullValueInVariableException) { result = null; } } else { result = string.Empty; } return(true); }
public void BlankRecordSetData(string colName) { IIndexIterator ii = _internalObj.Keys; if (colName != null) { Dev2Column cc = Columns.FirstOrDefault(c => c.ColumnName == colName); if (cc != null) { while (ii.HasMore()) { int next = ii.FetchNextIndex(); // now blank all values at this location IBinaryDataListItem itm = Dev2BinaryDataListFactory.CreateBinaryItem(string.Empty, Namespace, cc.ColumnName, next); string error; TryPutRecordItemAtIndex(itm, next, out error); } } else { ClearAll(ii); } } else { ClearAll(ii); } }
public void AllUpper_Complex_String_Expected_All_UpperCase() { IBinaryDataListItem item = Dev2BinaryDataListFactory.CreateBinaryItem("string.(to)@ 'make' u//ppercase", ""); IBinaryDataListItem result = converter.TryConvert("UPPER", item); Assert.AreEqual("STRING.(TO)@ 'MAKE' U//PPERCASE", result.TheValue); }
public IBinaryDataListItem FetchScalar() { IBinaryDataListItem result = null; if (IsRecordset) { string error; return(TryFetchLastIndexedRecordsetUpsertPayload(out error)); } if (_internalObj.Count > 0) { var binaryDataListItems = _internalObj[0]; if (binaryDataListItems != null && binaryDataListItems.Count > 0) { result = binaryDataListItems[0]; } } if (result == null) { bool isSystemTag = TranslationConstants.systemTags.Cast <object>().Select((t, i) => TranslationConstants.systemTags.GetValue(i).ToString()).Any(key => Namespace.Contains(key)); result = isSystemTag ? new BinaryDataListItem("", Namespace) : new BinaryDataListItem(null, Namespace); // place miss into the collection _internalObj[0] = new List <IBinaryDataListItem> { result }; } return(result); }
void GetValues(IBinaryDataListEntry dlEntry, string value, int iterCnt, IIndexIterator idxItr, enRecordsetIndexType indexType, IList <IDebugItemResult> results, string initExpression, string labelText, string fieldName = null) { string error; int index = idxItr.FetchNextIndex(); if (string.IsNullOrEmpty(fieldName)) { IList <IBinaryDataListItem> record = dlEntry.FetchRecordAt(index, out error); // ReSharper disable LoopCanBeConvertedToQuery foreach (IBinaryDataListItem recordField in record) // ReSharper restore LoopCanBeConvertedToQuery { GetValue(dlEntry, value, iterCnt, fieldName, indexType, results, initExpression, recordField, index, false, labelText); } } else { IBinaryDataListItem recordField = dlEntry.TryFetchRecordsetColumnAtIndex(fieldName, index, out error); bool ignoreCompare = false; if (recordField == null) { if (dlEntry.Columns.Count == 1) { recordField = dlEntry.TryFetchIndexedRecordsetUpsertPayload(index, out error); ignoreCompare = true; } } GetValue(dlEntry, value, iterCnt, fieldName, indexType, results, initExpression, recordField, index, ignoreCompare, labelText); } }
public static IBinaryDataListEntry CreateScalarEntry(string valueForScalar, Guid dlId, out string error) { IBinaryDataListEntry entry = Dev2BinaryDataListFactory.CreateEntry(GlobalConstants.NullEntryNamespace, string.Empty, dlId); IBinaryDataListItem item = Dev2BinaryDataListFactory.CreateBinaryItem(valueForScalar, string.Empty); entry.TryPutScalar(item, out error); return(entry); }
static void DoNullVariableAssertion(IBinaryDataListItem binaryDataListItem) { try { var val = binaryDataListItem.TheValue; Assert.IsNull(val); } catch (Exception e) { StringAssert.Contains(e.Message, string.Format("No Value assigned for: [[{0}]]", binaryDataListItem.DisplayValue)); } }
private void InitRowBuffer(int cnt) { if (_rowData != null) { for (int i = 0; i < cnt; i++) { IBinaryDataListItem itm = DataListConstants.baseItem.Clone(); itm.UpdateRecordset(_lastRs); _rowData.Add(itm); } } }
/// <summary> /// Tries the fetch indexed recordset upsert payload. /// </summary> /// <param name="idx">The idx.</param> /// <param name="error">The error.</param> /// <returns></returns> IBinaryDataListItem InternalFetchIndexedRecordsetUpsertPayload(int idx, out string error) { // in this case there is a single row, with a single column's data to extract Dev2Column col = Columns.FirstOrDefault(); error = string.Empty; if (col != null) { IBinaryDataListItem result = TryFetchRecordsetColumnAtIndex(col.ColumnName, idx, out error); return(result); } return(null); }
public void TryPutRecordItemAtIndex(IBinaryDataListItem item, int idx, out string error) { error = "Is not recordset"; int myIdx = idx; if (IsRecordset) { if (idx <= FetchLastRecordsetIndex() && _internalObj.ContainsRow(myIdx)) { int colIdx = InternalFetchColumnIndex(item.FieldName); if (colIdx >= 0) { _internalObj[myIdx] = new List <IBinaryDataListItem> { item }; error = string.Empty; _internalObj.IsEmtpy = false; _internalObj.Keys.RemoveGap(myIdx); } else { error = "Mapping error: Column not Found" + item.FieldName; } } else if (idx >= 1) { int colIdx = InternalFetchColumnIndex(item.FieldName); if (colIdx >= 0) { string ns = item.Namespace == string.Empty ? Namespace : item.Namespace; item.UpdateIndex(myIdx); item.UpdateRecordset(ns); IList <IBinaryDataListItem> cols = new List <IBinaryDataListItem> { item }; _internalObj[myIdx] = cols; _internalObj.IsEmtpy = false; _internalObj.Keys.RemoveGap(myIdx); error = string.Empty; } else { error = "Mapping error: Column not found " + item.FieldName; } } } }
public void SerializeToXML_ValidXML_BlankXML_Expect_Blank_Values_Returned() { string error; ErrorResultTO errors; IDataListTranslator xmlConverter = Dls.GetTranslator(XmlFormat); byte[] data = (TestHelper.ConvertStringToByteArray("")); IBinaryDataList obj = xmlConverter.ConvertTo(data, _dataListWellformedDescAttributes, out errors); IList <IBinaryDataListEntry> scalars = obj.FetchScalarEntries(); IList <IBinaryDataListEntry> recordsets = obj.FetchRecordsetEntries(); IBinaryDataListItem item = scalars[0].FetchScalar(); IList <IBinaryDataListItem> items = recordsets[0].FetchRecordAt(1, out error); Assert.IsTrue(item != null && items != null); }
public IBinaryDataListItem TryFetchRecordsetColumnAtIndex(string field, int idx, out string error) { IList <IBinaryDataListItem> cols = FetchRecordAt(idx, field, out error); IBinaryDataListItem result = DataListConstants.baseItem.Clone(); if (cols == null || cols.Count == 0) { error = "Index [ " + idx + " ] is out of bounds"; } else { result = cols.FirstOrDefault(c => c.FieldName == field); } return(result); }
/// <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> /// Gets a value from data list for a expression. /// </summary> /// <param name="expression">The expression to find the value for.</param> /// <param name="datalistID">The datalist unique identifier.</param> /// <param name="compiler">The compiler.</param> /// <returns></returns> /// <exception cref="System.Exception"></exception> private static string GetValueFromDataList(string expression, Guid datalistID, IDataListCompiler compiler) { expression = DataListUtil.AddBracketsToValueIfNotExist(expression); ErrorResultTO errors; IBinaryDataListEntry returnedEntry = compiler.Evaluate(datalistID, enActionType.User, expression, false, out errors); if (returnedEntry == null) { throw new Exception(errors.MakeUserReady()); } IBinaryDataListItem item = returnedEntry.FetchScalar(); string result = item.TheValue; return(result); }
public void TryPutScalar(IBinaryDataListItem item, out string error) { error = "Not a scalar"; if (!IsRecordset) { // set evaluation scalar // ReSharper disable ConvertIfStatementToConditionalTernaryExpression if (item.FieldName == GlobalConstants.EvalautionScalar) // ReSharper restore ConvertIfStatementToConditionalTernaryExpression { IsEvaluationScalar = true; } else { IsEvaluationScalar = false; } // set managment service payload // ReSharper disable ConvertIfStatementToConditionalTernaryExpression if (item.FieldName == GlobalConstants.ManagementServicePayload) // ReSharper restore ConvertIfStatementToConditionalTernaryExpression { IsManagmentServicePayload = true; } else { IsManagmentServicePayload = false; } try { #pragma warning disable 168 var theValue = item.TheValue; #pragma warning restore 168 error = string.Empty; } catch (Exception e) { error = e.Message; } _internalObj[0] = new List <IBinaryDataListItem> { item }; _internalObj.IsEmtpy = false; } }
/// <summary> /// Processes the scalar. /// </summary> /// <param name="entry">The entry.</param> /// <returns></returns> private string ProcessScalar(IBinaryDataListEntry entry) { StringBuilder result = new StringBuilder(); string fName = entry.Namespace; IBinaryDataListItem val = entry.FetchScalar(); if (val != null) { result.Append("\""); result.Append(fName); result.Append("\":\""); result.Append(val.TheValue); result.Append("\""); } return(result.ToString()); }
internal static void DoScalarAppending(StringBuilder result, string fName, IBinaryDataListItem val) { result.Append("<"); result.Append(fName); result.Append(">"); try { result.Append(val.TheValue); } // ReSharper disable EmptyGeneralCatchClause catch (Exception) // ReSharper restore EmptyGeneralCatchClause { } result.Append("</"); result.Append(fName); result.Append(">"); }
public void BaseConvertRecsetWithStarIndexToBinaryExpectedOutputToCorrectRecords() { SetupArguments( @"<root></root>" , ActivityStrings.BaseConvert_DLShape.Replace("<ADL>", "<ADL><setup/>") , new List <BaseConvertTO> { new BaseConvertTO("", "Text", "Binary", "[[setup]]", 1) } ); IDSFDataObject result = ExecuteProcess(); ErrorResultTO errorResult; IBinaryDataList bdl = Compiler.FetchBinaryDataList(result.DataListID, out errorResult); IBinaryDataListItem isolatedRecord = Dev2BinaryDataListFactory.CreateBinaryItem("CONVERT THIS TO BINARY", "Field"); string error; IBinaryDataListEntry entry; bdl.TryGetEntry("Recset", out entry, out error); entry.TryPutRecordItemAtIndex(isolatedRecord, 5, out error); IList <BaseConvertTO> convertCollection = new List <BaseConvertTO> { new BaseConvertTO("[[Recset(*).Field]]", "Text", "Binary", "[[Recset(*).Field]]", 1) }; TestStartNode = new FlowStep { Action = new DsfBaseConvertActivity { ConvertCollection = convertCollection } }; result = ExecuteProcess(); IList <IBinaryDataListEntry> actual = bdl.FetchRecordsetEntries(); var index = actual[0].FetchRecordAt(5, out error)[0].ItemCollectionIndex; var count = actual.Count(); var actualValue = actual[0].FetchRecordAt(5, out error)[0].TheValue; // remove test datalist ;) DataListRemoval(result.DataListID); Assert.AreEqual("01000011010011110100111001010110010001010101001001010100001000000101010001001000010010010101001100100000010101000100111100100000010000100100100101001110010000010101001001011001", actualValue); Assert.AreEqual(1, count); // still only one record Assert.AreEqual(5, index); // and that record has not moved }
public void UpsertWhereListStringExpectUpsertCorrectlyMultipleRecordset() { //------------Setup for test-------------------------- IDataListCompiler compiler = DataListFactory.CreateDataListCompiler(); IDev2DataListUpsertPayloadBuilder <List <string> > toUpsert = Dev2DataListBuilderFactory.CreateStringListDataListUpsertBuilder(); toUpsert.Add("[[rec().f1]]", new List <string> { "test11", "test12" }); toUpsert.Add("[[rec().f2]]", new List <string> { "test21", "test22" }); IBinaryDataList dataList = Dev2BinaryDataListFactory.CreateDataList(); string creationError; dataList.TryCreateRecordsetTemplate("rec", "recset", new List <Dev2Column> { DataListFactory.CreateDev2Column("f1", "f1"), DataListFactory.CreateDev2Column("f2", "f2") }, true, out creationError); ErrorResultTO localErrors; compiler.PushBinaryDataList(dataList.UID, dataList, out localErrors); //------------Execute Test--------------------------- compiler.Upsert(dataList.UID, toUpsert, out _errors); //------------Assert Results------------------------- IList <IBinaryDataListEntry> binaryDataListEntries = dataList.FetchRecordsetEntries(); IBinaryDataListEntry binaryDataListEntry = binaryDataListEntries[0]; string errString; IList <IBinaryDataListItem> binaryDataListItems = binaryDataListEntry.FetchRecordAt(1, out errString); IBinaryDataListItem binaryDataListItem = binaryDataListItems[0]; IBinaryDataListItem binaryDataListItem2 = binaryDataListItems[1]; string theValue = binaryDataListItem.TheValue; Assert.AreEqual("test11", theValue); theValue = binaryDataListItem2.TheValue; Assert.AreEqual("test21", theValue); binaryDataListItems = binaryDataListEntry.FetchRecordAt(2, out errString); binaryDataListItem = binaryDataListItems[0]; binaryDataListItem2 = binaryDataListItems[1]; theValue = binaryDataListItem.TheValue; Assert.AreEqual("test12", theValue); theValue = binaryDataListItem2.TheValue; Assert.AreEqual("test22", theValue); }
internal static void DoScalarAppending(StringBuilder result, string fName, IBinaryDataListItem val) { result.Append("<"); result.Append(fName); result.Append(">"); try { result.Append(val.TheValue); } // ReSharper disable EmptyGeneralCatchClause catch(Exception) // ReSharper restore EmptyGeneralCatchClause { } result.Append("</"); result.Append(fName); result.Append(">"); }
public IBinaryDataListItem TryConvert(string conversionType, IBinaryDataListItem item) { Func<string, string> returnedFunc; IBinaryDataListItem result = Dev2BinaryDataListFactory.CreateBinaryItem("Error Invalid Conversion Type", GlobalConstants.EvalautionScalar); if (_convertFunctions.TryGetValue(conversionType, out returnedFunc)) { if (returnedFunc != null) { string tmp = returnedFunc.Invoke(item.TheValue); if (item.Namespace != string.Empty) { result = Dev2BinaryDataListFactory.CreateBinaryItem(tmp, item.Namespace, item.FieldName, item.ItemCollectionIndex); } else { result = Dev2BinaryDataListFactory.CreateBinaryItem(tmp, item.FieldName); } } } return result; }
/// <summary> /// A new version of GetValue since Evaluate will now handle complex expressions it is now possible to create gnarly looking debug items /// This method handles these ;) /// </summary> /// <param name="dlEntry">The dl entry.</param> /// <param name="indexType">Type of the index.</param> /// <param name="results">The results.</param> /// <param name="initExpression">The init expression.</param> /// <param name="recordField">The record field.</param> /// <param name="index">The index.</param> /// <param name="labelText"></param> void NewGetValue(IBinaryDataListEntry dlEntry, enRecordsetIndexType indexType, IList<IDebugItemResult> results, string initExpression, IBinaryDataListItem recordField, int index, string labelText) { string injectVal = string.Empty; ComplexExpressionAuditor auditorObj = dlEntry.ComplexExpressionAuditor; if(indexType == enRecordsetIndexType.Star && auditorObj != null) { string instanceData; IList<ComplexExpressionAuditItem> auditData = auditorObj.FetchAuditItems(); if(index <= auditData.Count && index > 0) { ComplexExpressionAuditItem useData = auditData[index - 1]; instanceData = useData.TokenBinding; injectVal = useData.BoundValue; } else { string recsetName = DataListUtil.CreateRecordsetDisplayValue(dlEntry.Namespace, recordField.FieldName, index.ToString(CultureInfo.InvariantCulture)); instanceData = DataListUtil.AddBracketsToValueIfNotExist(recsetName); } results.Add(new DebugItemResult { Label = labelText, Type = DebugItemResultType.Variable, Value = injectVal, Operator = string.IsNullOrEmpty(instanceData) ? "" : "=", Variable = instanceData, GroupName = initExpression, GroupIndex = index }); } else { injectVal = recordField.TheValue; string displayValue = recordField.DisplayValue; if(displayValue.IndexOf(GlobalConstants.NullEntryNamespace, StringComparison.Ordinal) >= 0) { displayValue = DataListUtil.CreateRecordsetDisplayValue("Evaluated", GlobalConstants.EvaluationRsField, index.ToString(CultureInfo.InvariantCulture)); } results.Add(new DebugItemResult { Type = DebugItemResultType.Variable, Variable = DataListUtil.AddBracketsToValueIfNotExist(displayValue), Operator = string.IsNullOrEmpty(displayValue) ? "" : "=", GroupName = initExpression, Value = injectVal, GroupIndex = index }); } }
void OldGetValue(IBinaryDataListEntry dlEntry, string value, int iterCnt, string fieldName, enRecordsetIndexType indexType, IList<IDebugItemResult> results, string initExpression, IBinaryDataListItem recordField, int index, string labelText) { if((string.IsNullOrEmpty(fieldName) || recordField.FieldName.Equals(fieldName, StringComparison.InvariantCultureIgnoreCase))) { string injectVal; try { injectVal = recordField.TheValue; } catch(Exception) { injectVal = ""; } if(!string.IsNullOrEmpty(value) && recordField.ItemCollectionIndex == (iterCnt + 1)) { injectVal = value; _rsCachedValues[recordField.DisplayValue] = injectVal; } else if(string.IsNullOrEmpty(injectVal) && recordField.ItemCollectionIndex != (iterCnt + 1)) { // is it in the cache? ;) _rsCachedValues.TryGetValue(recordField.DisplayValue, out injectVal); if(injectVal == null) { injectVal = string.Empty; } } string recsetName; if(indexType == enRecordsetIndexType.Star) { recsetName = DataListUtil.CreateRecordsetDisplayValue(dlEntry.Namespace, recordField.FieldName, index.ToString(CultureInfo.InvariantCulture)); recsetName = DataListUtil.AddBracketsToValueIfNotExist(recsetName); } else { recsetName = DataListUtil.AddBracketsToValueIfNotExist(recordField.DisplayValue); } results.Add(new DebugItemResult { Label = labelText, Type = DebugItemResultType.Variable, Variable = recsetName, Operator = string.IsNullOrEmpty(recsetName) ? "" : "=", Value = injectVal, GroupName = initExpression, GroupIndex = index }); } }
static void DoNullVariableAssertion(IBinaryDataListItem binaryDataListItem) { try { var val = binaryDataListItem.TheValue; Assert.IsNull(val); } catch(Exception e) { StringAssert.Contains(e.Message, string.Format("No Value assigned for: [[{0}]]", binaryDataListItem.DisplayValue)); } }
void GetValue(IBinaryDataListEntry dlEntry, string value, int iterCnt, string fieldName, enRecordsetIndexType indexType, IList<IDebugItemResult> results, string initExpression, IBinaryDataListItem recordField, int index, bool ignoreCompare, string labelText) { if(!ignoreCompare) { OldGetValue(dlEntry, value, iterCnt, fieldName, indexType, results, initExpression, recordField, index, labelText); } else { NewGetValue(dlEntry, indexType, results, initExpression, recordField, index, labelText); } }