Ejemplo n.º 1
0
        public void InsertIdentity_Operation_Matches_Expected_Data()
        {
            using (INDbUnitTest database = GetNDbUnitTest())
            {
                DataSet expectedDataSet = BuildDataSet(GetXmlFilename());

                database.ReadXmlSchema(ReadOnlyStreamFromFilename(GetXmlSchemaFilename()));
                database.ReadXml(ReadOnlyStreamFromFilename(GetXmlFilename()));

                database.PerformDbOperation(DbOperationFlag.DeleteAll);
                database.PerformDbOperation(DbOperationFlag.InsertIdentity);

                DataSet actualDataSet = database.GetDataSetFromDb(null);

                Assert.That(actualDataSet.HasTheSameDataAs(expectedDataSet));
            }
        }
Ejemplo n.º 2
0
        public void Refresh_Operation_Matches_Expected_Data()
        {
            using (INDbUnitTest database = GetNDbUnitTest())
            {
                database.ReadXmlSchema(ReadOnlyStreamFromFilename(GetXmlSchemaFilename()));
                database.ReadXml(ReadOnlyStreamFromFilename(GetXmlFilename()));

                database.PerformDbOperation(DbOperationFlag.DeleteAll);
                database.PerformDbOperation(DbOperationFlag.InsertIdentity);

                database.ReadXml(GetXmlRefreshFilename());
                database.PerformDbOperation(DbOperationFlag.Refresh);

                DataSet actualDataSet = database.GetDataSetFromDb(null);

                DataSet originalDataSet = BuildDataSet(GetXmlFilename());
                DataSet refreshDataSet  = BuildDataSet(GetXmlRefreshFilename());
                var     expectedDataSet = new DataSet();
                expectedDataSet.ReadXmlSchema(ReadOnlyStreamFromFilename(GetXmlSchemaFilename()));
                MergeDataSet(expectedDataSet, originalDataSet, refreshDataSet);

                Assert.That(actualDataSet.HasTheSameDataAs(expectedDataSet));
            }
        }
Ejemplo n.º 3
0
 public DataSet GetDataSetFromDatabase(string xsdFilePath)
 {
     _database.ReadXmlSchema(xsdFilePath);
     return(_database.GetDataSetFromDb());
 }