Beispiel #1
0
        public void TestDAOExecuteNoQuery()
        {
            var       instanceDAO = new FOReserva.DataAccess.DataAccessObject.Common.DAO();
            DAOResult result      = null;

            result = instanceDAO.OpenConnection();
            Debug.WriteLine(String.Format("Message OpenConnection: {0}", result.Message));
            Assert.IsTrue(result.ProcessFinishCorrectly);

            result = instanceDAO.ExecuteNoQuery(String.Format(@"INSERT INTO dbo.TableForTUnit VALUES ('TestRevision at {0}')", DateTime.Now.ToString("dd/MM/yyyy")));
            Debug.WriteLine(String.Format("Message ExecuteQuery: {0}", result.Message));
            Assert.IsTrue(result.ProcessFinishCorrectly);

            result = instanceDAO.CloseConnection();
            Debug.WriteLine(String.Format("Message CloseConnection: {0}", result.Message));
            Assert.IsTrue(result.ProcessFinishCorrectly);
        }
Beispiel #2
0
        public void TestDAOExecuteStoreProcedure()
        {
            var       instanceDAO = new FOReserva.DataAccess.DataAccessObject.Common.DAO();
            DAOResult result      = null;

            result = instanceDAO.OpenConnection();
            Debug.WriteLine(String.Format("Message OpenConnection: {0}", result.Message));
            Assert.IsTrue(result.ProcessFinishCorrectly);

            result = instanceDAO.ExecuteStoreProcedure("M20_TestProcedure", new { thisAt = DateTime.Now.ToString("dd/MM/yyyy") });
            Debug.WriteLine(String.Format("Message ExecuteQuery: {0}", result.Message));
            Assert.IsTrue(result.ProcessFinishCorrectly);

            result = instanceDAO.CloseConnection();
            Debug.WriteLine(String.Format("Message CloseConnection: {0}", result.Message));
            Assert.IsTrue(result.ProcessFinishCorrectly);
        }
Beispiel #3
0
        public void TestDAOExecuteQuery()
        {
            var       instanceDAO = new FOReserva.DataAccess.DataAccessObject.Common.DAO();
            DAOResult result      = null;

            result = instanceDAO.OpenConnection();
            Debug.WriteLine(String.Format("Message OpenConnection: {0}", result.Message));
            Assert.IsTrue(result.ProcessFinishCorrectly);

            result = instanceDAO.ExecuteQuery(@"SELECT 'ok' AS ""output""", doThis: (reader) => {
                var output = reader.GetString(0);
                Debug.WriteLine(String.Format("Data from DB: {0}", output));
            });
            Debug.WriteLine(String.Format("Message ExecuteQuery: {0}", result.Message));
            Assert.IsTrue(result.ProcessFinishCorrectly);

            result = instanceDAO.CloseConnection();
            Debug.WriteLine(String.Format("Message CloseConnection: {0}", result.Message));
            Assert.IsTrue(result.ProcessFinishCorrectly);
        }