Exemplo n.º 1
0
        public void WriteToXmlWriter_ReadFromXmlReader()
        {
            var schemaBuilder = new StringBuilder();
            var xmlBuilder    = new StringBuilder();

            using (var schemaWriter = XmlWriter.Create(schemaBuilder))
            {
                this.dataSet.WriteXmlSchema(schemaWriter);
            }

            using (var xmlWriter = XmlWriter.Create(xmlBuilder))
            {
                this.dataSet.WriteXml(xmlWriter);
            }

            CremaDataSet dataSet = null;

            using (var sr = new StringReader(schemaBuilder.ToString()))
                using (var schemaReader = XmlReader.Create(sr))
                {
                    dataSet = CremaDataSet.ReadSchema(schemaReader);
                }

            using (var sr = new StringReader(xmlBuilder.ToString()))
                using (var xmlReader = XmlReader.Create(sr))
                {
                    dataSet.ReadXml(xmlReader);
                }

            CremaComparer.CompareDataSet(this.dataSet, dataSet);
        }
Exemplo n.º 2
0
        public void WriteToTextWriter_ReadFromTextReader()
        {
            var schemaWriter = new StringWriter();
            var xmlWriter    = new StringWriter();

            this.dataSet.WriteXmlSchema(schemaWriter);
            this.dataSet.WriteXml(xmlWriter);

            var schemaReader = new StringReader(schemaWriter.ToString());
            var dataSet      = CremaDataSet.ReadSchema(schemaReader);
            var xmlReader    = new StringReader(xmlWriter.ToString());

            dataSet.ReadXml(xmlReader);

            CremaComparer.CompareDataSet(this.dataSet, dataSet);
        }
Exemplo n.º 3
0
        public void WriteToStream_ReadFromStream()
        {
            var schemaStream = new MemoryStream();
            var xmlStream    = new MemoryStream();

            this.dataSet.WriteXmlSchema(schemaStream);
            this.dataSet.WriteXml(xmlStream);

            schemaStream.Position = 0;
            xmlStream.Position    = 0;

            var dataSet = CremaDataSet.ReadSchema(schemaStream);

            dataSet.ReadXml(xmlStream);

            CremaComparer.CompareDataSet(this.dataSet, dataSet);
        }