protected void Initialize()
        {
            //DbProviderFactories.RegisterFactory("System.Data.SqlClient", SqlClientFactory.Instance);

            _unitTest = new SqlDbUnitTest(ConnectionString);
            _unitTest.ReadXmlSchema(XmlSchema);
        }
        public void FixtureSetup()
        {
            _database = new SqlDbUnitTest(ConnectionString);

            _database.ReadXmlSchema(@"..\..\Data\Lender.Slos.DataSet.xsd");
            _database.ReadXml(@"..\..\Data\ApplicationTotals_Scenario01.xml");
        }
        public void FixtureSetup()
        {
            _database = new SqlDbUnitTest(ConnectionString);

            _database.ReadXmlSchema(@"..\..\Data\Lender.Slos.DataSet.xsd");
            _database.ReadXml(@"..\..\Data\IndividualDalTests_Scenario01.xml");
        }
        public void Issue38_Test()
        {
            INDbUnitTest db = GetNDbUnitTest();

            db.ReadXmlSchema(@"Xml\MySql\DateAsPrimaryKey.xsd");
            db.ReadXml(@"Xml\MySql\DateAsPrimaryKey.xml");

            db.PerformDbOperation(DbOperationFlag.CleanInsertIdentity);
        }
 /// <summary>
 /// Loads the test schema.
 /// </summary>
 /// <param name="dbUnitTest">The db unit test.</param>
 public static void LoadTestSchema(INDbUnitTest dbUnitTest)
 {
     var assembly = typeof(TestSchemaLoader).Assembly;
     var resourceName = assembly.GetManifestResourceNames().Single(n => n.EndsWith("TestSchema.xsd", StringComparison.OrdinalIgnoreCase));
     using (var schemaStream = assembly.GetManifestResourceStream(resourceName))
     {
         dbUnitTest.ReadXmlSchema(schemaStream);
     }
 }
        public UnitTestContext()
        {
            new DatabaseBootstrapper(new DiarioAcademiaContext()).Configure();

            var connectionString = ConfigurationManager.ConnectionStrings["DiarioAcademiaContext"].ConnectionString;

            _db = new SqlDbUnitTest(connectionString);

            _db.ReadXmlSchema(XmlSchema);
        }
        public void TestFixtureSetUp()
        {
            _configuration = new Configuration();
            _configuration.Configure();
            _configuration.AddAssembly(typeof(Player).Assembly);
            _sessionFactory = _configuration.BuildSessionFactory();

            _mySqlDatabase = new SqlDbUnitTest(Properties.Settings.Default.NHibernateTrainingConnectionString);

            _mySqlDatabase.ReadXmlSchema(@"..\..\NHibernateTrainingDataSet.xsd");
            _mySqlDatabase.ReadXml(@"..\..\YearlyPitchingRepositoryTestData.xml");
        }
Exemple #8
0
        public void Setup(string data)
        {
            Migrate.Up(_connection.ConnectionString);

            _ndbUnitTest = new PostgresqlDbUnitTest(_connection.ConnectionString);
            _ndbUnitTest.ReadXmlSchema("Files/Schema.xsd");
            if (!string.IsNullOrEmpty(data))
            {
                _ndbUnitTest.ReadXml(data);
            }

            _ndbUnitTest.PerformDbOperation(DbOperationFlag.CleanInsertIdentity);
        }
Exemple #9
0
        public void Test()
        {
            _connectionString = "Data Source=:memory:;Version=3;New=True;";

            //Create an Instance of the NDbUnit database test class
            donSqlDatabase = new SqlLiteDbUnitTest(_connectionString);

            //Tell the NDbUnit test class what schema and data files to use
            donSqlDatabase.ReadXmlSchema(@"..\..\MyDataset.xsd");
            donSqlDatabase.ReadXml(@"..\..\DonTestData.xml");

            //Delete all existing data in the database and load test data
            donSqlDatabase.PerformDbOperation(NDbUnit.Core.DbOperationFlag.CleanInsertIdentity);

            var connection = new SqlLiteDbCommandBuilder(_connectionString);
        }
        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));
            }
        }
        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));
            }
        }
        public virtual void TestFixtureSetUp()
        {
            var connectionString = ConnectionStrings.TestDatabase;

            _test = new SqlDbUnitTest(connectionString);
            _test.ReadXmlSchema(@"Server\AuditDataModel.xsd");
        }
 public DataSet GetDataSetFromDatabase(string xsdFilePath)
 {
     _database.ReadXmlSchema(xsdFilePath);
     return(_database.GetDataSetFromDb());
 }