public OptomizedObservableCollection <IDataListItem> CreateListToBindTo(IBinaryDataList dataList)
        {
            var result = new OptomizedObservableCollection <IDataListItem>();

            if (dataList != null)
            {
                var listOfEntries = dataList.FetchScalarEntries();

                // process scalars ;)
                foreach (var entry in listOfEntries
                         .Where(e => ((e.ColumnIODirection == enDev2ColumnArgumentDirection.Input ||
                                       e.ColumnIODirection == enDev2ColumnArgumentDirection.Both))))
                {
                    result.AddRange(ConvertIBinaryDataListEntryToIDataListItem(entry));
                }

                // now process recordsets ;)
                listOfEntries = dataList.FetchRecordsetEntries();
                foreach (var entry in listOfEntries)
                {
                    result.AddRange(ConvertIBinaryDataListEntryToIDataListItem(entry));
                }
            }

            return(result);
        }
Пример #2
0
        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");
            }
        }
        public OptomizedObservableCollection<IDataListItem> CreateListToBindTo(IBinaryDataList dataList)
        {
            var result = new OptomizedObservableCollection<IDataListItem>();

            if(dataList != null)
            {
                var listOfEntries = dataList.FetchScalarEntries();

                // process scalars ;)
                foreach(var entry in listOfEntries
                    .Where(e => ((e.ColumnIODirection == enDev2ColumnArgumentDirection.Input ||
                                 e.ColumnIODirection == enDev2ColumnArgumentDirection.Both))))
                {
                    result.AddRange(ConvertIBinaryDataListEntryToIDataListItem(entry));
                }

                // now process recordsets ;)
                listOfEntries = dataList.FetchRecordsetEntries();
                foreach(var entry in listOfEntries)
                {
                    result.AddRange(ConvertIBinaryDataListEntryToIDataListItem(entry));
                }
            }

            return result;
        }
Пример #4
0
        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);
                    }
                }
            }
        }
Пример #5
0
        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);
        }
Пример #6
0
        public void SerializeToXML_ValidXMLWithDescriptions_Return_Decriptions_Expect_Sucess()
        {
            ErrorResultTO       errors;
            IDataListTranslator xmlConverter = Dls.GetTranslator(XmlFormat);

            byte[]          data = (TestHelper.ConvertStringToByteArray(DataListWellformedDataWithDesc));
            IBinaryDataList obj  = xmlConverter.ConvertTo(data, _dataListWellformedDescAttributes, out errors);

            IList <IBinaryDataListEntry> scalars    = obj.FetchScalarEntries();
            IList <IBinaryDataListEntry> recordsets = obj.FetchRecordsetEntries();

            var res1 = scalars[0].Description;
            var res2 = recordsets[0].Columns[0].ColumnDescription;

            Assert.AreEqual("Test scalar description", res1);
            Assert.AreEqual("Test field1 desciption", res2);
        }