Example #1
0
        public void ExecuteQuery_ByTextAndType()
        {
            // arrange
            string             sql        = "UPDATE fw.dbo.DIMENSION SET ATTR_DESCRIPTION = ATTR_DESCRIPTION WHERE ATTR_NAME = 'UTGDA'";
            string             database   = "CLARITY";
            int                expected   = 1;
            GHCDataAccessLayer dataAccess = GHCDataAccessLayerFactory.GetDataAccessLayer(DataProviderType.Sql, database);

            // act
            int actual = dataAccess.ExecuteQuery(sql, CommandType.Text);

            // assert
            Assert.AreEqual(actual, expected, "Unexpected count of affected records");
        }
Example #2
0
        public int TestQueryResultCount()
        {
            string sql = "quotingengine.dbo.TEST_PROC";

            SqlParameter[] sqlParams =
            {
                new SqlParameter("@NAME", SqlDbType.VarChar)
                {
                    Value = "Josh"
                },
                new SqlParameter("@IMPORT_DATE", SqlDbType.DateTime)
                {
                    Value = DateTime.Now
                }
            };

            return(dataLayer.ExecuteQuery(sql, CommandType.StoredProcedure, 0, sqlParams));
        }
Example #3
0
        public void ExecuteQuery_ByTextAndParams()
        {
            // arrange
            string sql      = "UPDATE fw.dbo.DIMENSION SET ATTR_DESCRIPTION = ATTR_DESCRIPTION WHERE ATTR_NAME = @Name";
            string database = "CLARITY";
            int    expected = 1;

            SqlParameter[] sqlParams =
            {
                new SqlParameter("@Name", SqlDbType.VarChar)
                {
                    Value = "UTGDA"
                }
            };
            GHCDataAccessLayer dataAccess = GHCDataAccessLayerFactory.GetDataAccessLayer(DataProviderType.Sql, database);

            // act
            int actual = dataAccess.ExecuteQuery(sql, sqlParams);

            // assert
            Assert.AreEqual(actual, expected, "Unexpected count of affected records");
        }