public void GetDbRows_Good(string connString, string tableName, string appIdCol, string keyCol, string valCol, string appIdVal, string testCase)
        {
            DbSourceOptions options = new DbSourceOptions()
            {
                ConnString = connString,
                TableName  = tableName,
                AppIdCol   = appIdCol,
                KeyCol     = keyCol,
                ValCol     = valCol,
                AppIdVal   = appIdVal
            };
            ISqlClientAdo sqlClientDAL = new SqlClientAdo(options);
            var           actual       = sqlClientDAL.GetDbRows();
            var           expected     = JsonConvert.DeserializeObject <List <ConfigSetting> >(File.ReadAllText($"TestCases\\DbSource\\SqlClientAdo\\GetDbRows\\Good\\expected{testCase}.json"));

            Assert.True(TestHelper.SettingsAreEqual(expected, actual));
        }
示例#2
0
 // Accepts configuration parameter for non-default database options
 public DbConfigSource(IConfigurationBuilder builder, IConfiguration config, bool optional)
 {
     _optional = optional;
     try
     {
         // Create new dboptions object
         DbSourceOptions dbOptions = new DbSourceOptions(config, optional);
         // Initialize Sql client with dbOptions object
         _sqlClient = new SqlClientAdo(dbOptions);
     }
     catch (Exception e)
     {
         if (!optional)
         {
             throw e;
         }
         return;
     }
 }
示例#3
0
        //
        public DbConfigSource(IConfigurationBuilder builder, string conKeyVar, string appId, int sqlCommandTimeout, bool optional)
        {
            _optional = optional;

            try
            {
                // Create new dboptions object
                DbSourceOptions dbOptions = new DbSourceOptions(conKeyVar, appId, optional, sqlCommandTimeout);
                // Initialize Sql client with dbOptions object
                _sqlClient = new SqlClientAdo(dbOptions);
            }
            catch (Exception e)
            {
                if (!optional)
                {
                    throw e;
                }
                return;
            }
        }
示例#4
0
 public SqlClientAdo(DbSourceOptions options)
 {
     _options = options;
 }