Пример #1
0
        public void DerivedTableCopyTo1()
        {
            var dataSet      = new CremaDataSet();
            var dataTable    = dataSet.Tables.Add("Table1");
            var childTable   = dataTable.Childs.Add();
            var derivedTable = dataTable.Inherit("derived");

            var tempPath = PathUtility.GetTempPath(true);

            try
            {
                dataSet.WriteToDirectory(tempPath);

                dataSet = new CremaDataSet();
                dataSet.ReadTable(Path.Combine(tempPath, CremaSchema.TableDirectory, derivedTable.Name + ".xml"));
                derivedTable = dataSet.Tables["derived"];

                var targetSet   = new CremaDataSet();
                var targetTable = derivedTable.CopyTo(targetSet);
                CremaComparer.CompareTable(derivedTable, targetTable);

                var schema = targetSet.GetXmlSchema();
            }
            finally
            {
                DirectoryUtility.Delete(tempPath);
            }
        }
Пример #2
0
 public static void CompareSchema(CremaDataSet dataSet1, CremaDataSet dataSet2)
 {
     try
     {
         Assert.AreEqual(dataSet1.GetXmlSchema(), dataSet2.GetXmlSchema(), "Schema");
     }
     catch
     {
         File.WriteAllText(Path.Combine(Directory.GetCurrentDirectory(), "dataSet1" + CremaSchema.SchemaExtension), dataSet1.GetXmlSchema());
         File.WriteAllText(Path.Combine(Directory.GetCurrentDirectory(), "dataSet2" + CremaSchema.SchemaExtension), dataSet2.GetXmlSchema());
         throw;
     }
 }
Пример #3
0
        public void DerivedTableCopyTo()
        {
            var dataSet      = new CremaDataSet();
            var dataTable    = dataSet.Tables.Add("Table1");
            var childTable   = dataTable.Childs.Add();
            var derivedTable = dataTable.Inherit("derived");
            var targetSet    = new CremaDataSet();
            var targetTable  = derivedTable.CopyTo(targetSet);

            CremaComparer.CompareTable(derivedTable, targetTable);

            var schema = targetSet.GetXmlSchema();
        }