Ejemplo n.º 1
0
        public void DeSerializeToXMLFromBinary_InvertedIndexInsert_ValidXML_Expect_Sucess()
        {
            IBinaryDataList   dl = Dev2BinaryDataListFactory.CreateDataList();
            string            error;
            List <Dev2Column> cols = new List <Dev2Column>();
            ErrorResultTO     errors;

            cols.Add(DataListFactory.CreateDev2Column("f1", ""));
            cols.Add(DataListFactory.CreateDev2Column("f2", ""));
            cols.Add(DataListFactory.CreateDev2Column("f3", ""));
            IDataListTranslator xmlConverter = Dls.GetTranslator(XmlFormat);


            dl.TryCreateRecordsetTemplate("rs1", "", cols, true, out error);
            dl.TryCreateScalarTemplate(string.Empty, "scalar1", "", true, out error);
            dl.TryCreateScalarValue("scalar1Value", "scalar1", out error);
            dl.TryCreateRecordsetValue("rec1.f2.vale", "f2", "rs1", 1, out error);
            dl.TryCreateRecordsetValue("rec1.f1.vale", "f1", "rs1", 1, out error);
            dl.TryCreateRecordsetValue("rec1.f3.vale", "f3", "rs1", 1, out error);
            dl.TryCreateRecordsetValue("rec2.f1.vale", "f1", "rs1", 2, out error);
            dl.TryCreateRecordsetValue("rec2.f2.vale", "f2", "rs1", 2, out error);
            dl.TryCreateRecordsetValue("rec2.f3.vale", "f3", "rs1", 2, out error);

            DataListTranslatedPayloadTO tmp = xmlConverter.ConvertFrom(dl, out errors);

            string result = tmp.FetchAsString().ToString();

            Assert.AreEqual("<DataList><rs1><f1>rec1.f1.vale</f1><f2>rec1.f2.vale</f2><f3>rec1.f3.vale</f3></rs1><rs1><f1>rec2.f1.vale</f1><f2>rec2.f2.vale</f2><f3>rec2.f3.vale</f3></rs1><scalar1>scalar1Value</scalar1></DataList>", result);
        }
Ejemplo n.º 2
0
        public void DeSerializeToXMLInputsOnlyFromBinary_ValidXML_Expect_Sucess()
        {
            IBinaryDataList   dl    = Dev2BinaryDataListFactory.CreateDataList();
            List <Dev2Column> cols1 = new List <Dev2Column>
            {
                DataListFactory.CreateDev2Column("f1", ""),
            };
            List <Dev2Column> cols2 = new List <Dev2Column>
            {
                DataListFactory.CreateDev2Column("f2", ""),
            };
            string        error;
            ErrorResultTO errors;


            IDataListTranslator xmlConverter = Dls.GetTranslator(XmlFormatInputsOnly);

            dl.TryCreateRecordsetTemplate("rs1", "", cols1, true, out error);
            dl.TryCreateRecordsetTemplate("rs2", "", cols2, true, true, enDev2ColumnArgumentDirection.Input, out error);
            dl.TryCreateScalarTemplate("", "scalar1", "", true, true, enDev2ColumnArgumentDirection.Input, out error);
            dl.TryCreateScalarTemplate("", "scalar2", "", true, true, enDev2ColumnArgumentDirection.Output, out error);
            dl.TryCreateScalarValue("scalar1Value", "scalar1", out error);
            dl.TryCreateScalarValue("scalar2Value", "scalar2", out error);
            dl.TryCreateRecordsetValue("rec1.f1.value", "f1", "rs1", 1, out error);
            dl.TryCreateRecordsetValue("rec1.f2.value", "f2", "rs2", 1, out error);
            dl.TryCreateRecordsetValue("rec2.f1.value", "f1", "rs1", 2, out error);
            dl.TryCreateRecordsetValue("rec2.f2.value", "f2", "rs2", 2, out error);

            DataListTranslatedPayloadTO tmp = xmlConverter.ConvertFrom(dl, out errors);

            string result = tmp.FetchAsString().ToString();

            Assert.AreEqual("<DataList><scalar1>scalar1Value</scalar1></DataList>", result);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Converts to selected Type from binary
        /// </summary>
        /// <param name="curDlid">The cur DLID.</param>
        /// <param name="typeOf">The type of.</param>
        /// <param name="depth">The depth.</param>
        /// <param name="errors">The errors.</param>
        /// <returns></returns>
        public StringBuilder ConvertFrom(Guid curDlid, DataListFormat typeOf, enTranslationDepth depth, out ErrorResultTO errors)
        {
            DataListTranslatedPayloadTO tmp = _svrCompiler.ConvertFrom(null, curDlid, depth, typeOf, out errors);

            if (tmp != null)
            {
                return(tmp.FetchAsString());
            }

            return(new StringBuilder());
        }