Esempio n. 1
0
        public void ExecuteDataReader_ByTextAndType()
        {
            // arrange
            string             sql        = "SELECT TOP 1 * FROM clarity.dbo.PATIENT";
            string             database   = "CLARITY";
            GHCDataAccessLayer dataAccess = GHCDataAccessLayerFactory.GetDataAccessLayer(DataProviderType.Sql, database);

            // act
            DbDataReader dr = (DbDataReader)dataAccess.ExecuteDataReader(sql, CommandType.Text);

            // assert
            Assert.IsTrue(dr.HasRows, "0 rows returned, 1 expected");
        }
Esempio n. 2
0
        public void ExecuteDataReader_ByTextAndParams()
        {
            // arrange
            string sql      = "SELECT TOP 1 * FROM clarity.dbo.PATIENT WHERE City = @City";
            string database = "CLARITY";

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

            // act
            DbDataReader dr = (DbDataReader)dataAccess.ExecuteDataReader(sql, sqlParams);

            // assert
            Assert.IsTrue(dr.HasRows, "0 rows returned, 1 expected");
        }