예제 #1
0
 public virtual void TestFixtureSetUp()
 {
     _test = new SqlDbUnitTest(ConnectionStrings.TestDatabase);
     TestSchemaLoader.LoadTestSchema(_test);
     _test.ReadXml("ProviderData.xml");
     _objectContextFactory = new TestObjectContextFactory(ConnectionStrings.TestDatabase);
 }
예제 #2
0
 public void TestFixtureSetUp()
 {
     EntityFrameworkProfiler.Initialize();
     Test = new SqlDbUnitTest(ConnectionStrings.TestDatabase);
     TestSchemaLoader.LoadTestSchema(Test);
     Test.ReadXml("SettingsData.xml");
 }
        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");
        }
예제 #5
0
        protected void Initialize()
        {
            //DbProviderFactories.RegisterFactory("System.Data.SqlClient", SqlClientFactory.Instance);

            _unitTest = new SqlDbUnitTest(ConnectionString);
            _unitTest.ReadXmlSchema(XmlSchema);
        }
예제 #6
0
 public virtual void TestFixtureSetUp()
 {
     _test = new SqlDbUnitTest(ConnectionStrings.TestDatabase);
     TestSchemaLoader.LoadTestSchema(_test);
     _test.ReadXml("ServiceDetails\\ServiceDetails.xml");
     _objectContextFactory = new TestObjectContextFactory(ConnectionStrings.TestDatabase);
     _entityContextFactory = new TestEntityContextFactory(ConnectionStrings.TestDatabase);
 }
예제 #7
0
 /// <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 MappingSourcesSteps()
 {
     sqlConnection = new SqlConnection(Database.TestConnectionString);
     database      = Database.Initialize(sqlConnection);
     rmlProc       = new W3CR2RMLProcessor(sqlConnection)
     {
         Log = new TextWriterLog(Console.Out)
     };
 }
예제 #9
0
 public virtual void TestFixtureSetUp()
 {
     AutoMapperConfiguration.Configure();
     _test = new SqlDbUnitTest(ConnectionStrings.TestDatabase);
     TestSchemaLoader.LoadTestSchema(_test);
     _test.ReadXml("CodeSnippets\\CodeSnippetDataRRSL.xml");
     _objectContextFactory = new TestObjectContextFactory(ConnectionStrings.TestDatabase);
     _entityContextFactory = new TestEntityContextFactory(ConnectionStrings.TestDatabase);
 }
        public void Issue38_Test()
        {
            INDbUnitTest db = GetNDbUnitTest();

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

            db.PerformDbOperation(DbOperationFlag.CleanInsertIdentity);
        }
        public void Setup()
        {
            string cnn = ConfigurationManager.ConnectionStrings["storedb_development"].ConnectionString;
            this._ndbUnitTest = new NDbUnit.Core.SqlClient.SqlDbUnitTest(cnn);
            this._ndbUnitTest.ReadXmlSchema("StoreSchema.xsd");
            this._ndbUnitTest.PerformDbOperation(NDbUnit.Core.DbOperationFlag.DeleteAll);

            NHibernate.ISession session = HarryPotter.Database.DataContextBuilder.BuildSession();
            this._dataContext = new ImproveIT.Data.Hibernate.HibernateDataContext(session);
        }
예제 #12
0
        public UnitTestContext()
        {
            new DatabaseBootstrapper(new DiarioAcademiaContext()).Configure();

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

            _db = new SqlDbUnitTest(connectionString);

            _db.ReadXmlSchema(XmlSchema);
        }
예제 #13
0
		public void when_there_is_any_row_then_retur_them()
		{
			this.iNDbUnitTest = new SqlDbUnitTest(@"server=.\sql2008;database=devdays;integrated security = SSPI");
			this.iNDbUnitTest.ReadXmlSchema(@".\ListDataSet.xsd");
			this.iNDbUnitTest.ReadXml(@".\ListDataSet.xml");

			this.iNDbUnitTest.PerformDbOperation(DbOperationFlag.CleanInsertIdentity);

			BookRepository sut = new BookRepository();
			sut.List().Count.Should().Be(3);
		}
        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");
        }
예제 #15
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);
        }
예제 #16
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);
        }
예제 #17
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));
            }
        }
예제 #18
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));
            }
        }
예제 #19
0
 public DbTester(INDbUnitTest database)
 {
     this.database = database;
 }
예제 #20
0
        public void Setup(string databaseConnectionString, DatabaseClientType databaseType)
        {
            if (String.IsNullOrEmpty(databaseConnectionString))
            {
                throw new ArgumentException("databaseConnectionString is null or empty.", "databaseConnectionString");
            }

            _databaseConnectionString = databaseConnectionString;
            _databaseType             = databaseType;

            switch (_databaseType)
            {
            case DatabaseClientType.MySqlClient:
            {
                _databaseConnection = new MySql.Data.MySqlClient.MySqlConnection(_databaseConnectionString);
                _database           = new NDbUnit.Core.MySqlClient.MySqlDbUnitTest(_databaseConnectionString);
                break;
            }

            case DatabaseClientType.OleDBClient:
            {
                _databaseConnection = new System.Data.OleDb.OleDbConnection(_databaseConnectionString);
                _database           = new NDbUnit.Core.OleDb.OleDbUnitTest(_databaseConnectionString);
                break;
            }

            case DatabaseClientType.OracleClient:
            {
                _databaseConnection = new System.Data.OracleClient.OracleConnection(_databaseConnectionString);
                _database           = new NDbUnit.OracleClient.OracleClientDbUnitTest(_databaseConnectionString);
                break;
            }

            case DatabaseClientType.PostgresqlClient:
            {
                _databaseConnection = new Npgsql.NpgsqlConnection(_databaseConnectionString);
                _database           = new NDbUnit.Postgresql.PostgresqlDbUnitTest(_databaseConnectionString);
                break;
            }

            case DatabaseClientType.SqlCeClient:
            {
                _databaseConnection = new System.Data.SqlServerCe.SqlCeConnection(_databaseConnectionString);
                _database           = new NDbUnit.Core.SqlServerCe.SqlCeDbUnitTest(_databaseConnectionString);
                break;
            }

            case DatabaseClientType.SqlClient:
            {
                _databaseConnection = new System.Data.SqlClient.SqlConnection(_databaseConnectionString);
                _database           = new NDbUnit.Core.SqlClient.SqlDbUnitTest(_databaseConnectionString);
                break;
            }

            case DatabaseClientType.SqliteClient:
            {
                _databaseConnection = new System.Data.SQLite.SQLiteConnection(_databaseConnectionString);
                _database           = new NDbUnit.Core.SqlLite.SqlLiteDbUnitTest(_databaseConnectionString);
                break;
            }

            default:
                throw new InvalidOperationException("you have selected an invalid database type!");
            }
        }
예제 #21
0
        public virtual void TestFixtureSetUp()
        {
            var connectionString = ConnectionStrings.TestDatabase;

            _test = new SqlDbUnitTest(connectionString);
            _test.ReadXmlSchema(@"Server\AuditDataModel.xsd");
        }