コード例 #1
0
        public void Members_DifferentArguments_HaveExpectedProps()
        {
            // Arrange
            IUtilityFactory utilityFactory = SQLiteUtilityFactory.Instance;

            // get SQLite stuff loaded.
            using (new SQLiteConnection())
            {
            }

            // Act
            var dbProviderName = utilityFactory.DbProviderName;

            IDbConnection connection       = utilityFactory.CreateConnection();
            var           tuple            = DbUtils.CreateSQLiteConnectionString();
            var           filePath         = tuple.Item1;
            var           connectionString = tuple.Item2;

            connection.ConnectionString = connectionString;
            connection.Open();

            IDialect dialect = utilityFactory.GetDialect();

            IScriptBuilder scriptBuilder = utilityFactory.CreateScriptBuilder();

            IDbInspector dbInspector = utilityFactory.CreateDbInspector(connection);

            ITableInspector tableInspector = utilityFactory.CreateTableInspector(connection, "language");

            ICruder cruder = utilityFactory.CreateCruder(connection);

            IDbSerializer dbSerializer = utilityFactory.CreateDbSerializer(connection);

            // Assert
            Assert.That(dbProviderName, Is.EqualTo("SQLite"));
            Assert.That(connection, Is.TypeOf <SQLiteConnection>());
            Assert.That(dialect, Is.SameAs(SQLiteDialect.Instance));

            Assert.That(scriptBuilder, Is.TypeOf <SQLiteScriptBuilder>());
            Assert.That(scriptBuilder.CurrentOpeningIdentifierDelimiter, Is.EqualTo('['));

            Assert.That(dbInspector, Is.TypeOf <SQLiteInspector>());
            Assert.That(tableInspector, Is.TypeOf <SQLiteTableInspector>());
            Assert.That(cruder, Is.TypeOf <SQLiteCruder>());
            Assert.That(dbSerializer, Is.TypeOf <SQLiteSerializer>());

            // Finalize
            connection.Dispose();
            try
            {
                File.Delete(filePath);
            }
            catch
            {
                // dismiss
            }
        }
コード例 #2
0
        public void Members_DifferentArguments_HaveExpectedProps()
        {
            // Arrange
            IUtilityFactory utilityFactory = SqlServerUtilityFactory.Instance;

            // Act
            var dbProviderName = utilityFactory.DbProviderName;

            IDbConnection connection = utilityFactory.CreateConnection();

            connection.ConnectionString = TestHelper.ConnectionString;
            connection.Open();

            IDialect dialect = utilityFactory.GetDialect();

            IScriptBuilder scriptBuilder = utilityFactory.CreateScriptBuilder();

            IDbInspector dbInspector = utilityFactory.CreateDbInspector(connection);

            ITableInspector tableInspector = utilityFactory.CreateTableInspector(connection, "language");

            ICruder cruder = utilityFactory.CreateCruder(connection);

            IDbSerializer dbSerializer = utilityFactory.CreateDbSerializer(connection);

            // Assert
            Assert.That(dbProviderName, Is.EqualTo("SqlServer"));
            Assert.That(connection, Is.TypeOf <SqlConnection>());
            Assert.That(dialect, Is.SameAs(SqlServerDialect.Instance));

            Assert.That(scriptBuilder, Is.TypeOf <SqlServerScriptBuilder>());
            Assert.That(scriptBuilder.CurrentOpeningIdentifierDelimiter, Is.EqualTo('['));

            Assert.That(dbInspector, Is.TypeOf <SqlServerInspector>());
            Assert.That(tableInspector, Is.TypeOf <SqlServerTableInspector>());
            Assert.That(cruder, Is.TypeOf <SqlServerCruder>());
            Assert.That(dbSerializer, Is.TypeOf <SqlServerSerializer>());
        }
コード例 #3
0
 public void SetUp()
 {
     _cruder = this.DbInspector.Factory.CreateCruder(this.Connection);
 }