Exemplo n.º 1
0
        public void Delete_Last_Record_Expected_Last_Row_Deleted()
        {
            var    entires        = _dl2.FetchRecordsetEntries();
            var    entry          = entires[0];
            int    preRecordCount = entry.ItemCollectionSize();
            string errors;
            bool   result          = entry.TryDeleteRows("", out errors);
            int    postRecordCount = entry.ItemCollectionSize();

            Assert.IsTrue(postRecordCount == (preRecordCount - 1));
            Assert.IsTrue(result);
        }
        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);
        }
Exemplo n.º 3
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;
        }
Exemplo n.º 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);
        }
Exemplo n.º 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);
        }
Exemplo n.º 7
0
        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);
        }
        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
        }