public void ExecuteStoredProcedureToDataSetWithoutParameters()
        {
            Framework.DataServices.CommonDatabase commonDatabase =
                new Framework.DataServices.CommonDatabase(ConnectionName, ConnectionString, ProviderName);

            DataSet dsResult = commonDatabase.ExecuteDataSet(
                CommandType.StoredProcedure,
                "sp_select_users", false, CurrentUser);
        }
        public void ExecuteTextToDataSetWithoutParameters()
        {
            Framework.DataServices.CommonDatabase commonDatabase =
                new Framework.DataServices.CommonDatabase(ConnectionName, ConnectionString, ProviderName);

            DataSet dsResult = commonDatabase.ExecuteDataSet(
                CommandType.Text,
                "SELECT * FROM Users", false, CurrentUser);
        }
        public void ExecuteStoredProcedureToDataSetWithIntParameters()
        {
            Framework.DataServices.CommonDatabase commonDatabase =
                new Framework.DataServices.CommonDatabase(ConnectionName, ConnectionString, ProviderName);

            DataSet dsResult = commonDatabase.ExecuteDataSet(
                CommandType.StoredProcedure,
                "sp_select_users", false, CurrentUser,
                commonDatabase.Parameters.Create("@Children", DbType.Int32, ParameterDirection.Input, 1));
        }
        public void FailedToExecutStoredProcedureToDataSetInWrongStoredProcedure()
        {
            Framework.DataServices.CommonDatabase commonDatabase =
                new Framework.DataServices.CommonDatabase(ConnectionName, ConnectionString, ProviderName);

            DataSet dsResult = commonDatabase.ExecuteDataSet(
                CommandType.StoredProcedure,
                "sp_select_users_fail", false, CurrentUser,
                commonDatabase.Parameters.Create("@BirthDate", DbType.Date, ParameterDirection.Input, DateTime.Now),
                commonDatabase.Parameters.Create("@Children", DbType.Int32, ParameterDirection.Input, 1));
        }
        public void ExecuteStoredProcedureToDataSetWithDefaultOutputParameters()
        {
            Framework.DataServices.CommonDatabase commonDatabase =
                new Framework.DataServices.CommonDatabase(ConnectionName, ConnectionString, ProviderName);

            DataSet dsResult = commonDatabase.ExecuteDataSet(
                CommandType.StoredProcedure,
                "sp_select_users_outputparameters", true, CurrentUser);


            Assert.AreEqual(commonDatabase.ExecutionStatus.ErrorNumber, 10);
            Assert.AreEqual(commonDatabase.ExecutionStatus.ErrorDescription, "User: "******" - Number: 10");
            Assert.AreEqual(commonDatabase.ExecutionStatus.CurrentUser, CurrentUser);
        }
        public void ExecuteTextToDataSetWithIntParameters()
        {
            Framework.DataServices.CommonDatabase commonDatabase =
                new Framework.DataServices.CommonDatabase(ConnectionName, ConnectionString, ProviderName);


            Framework.DataServices.ParameterConfiguration parameterConfig =
                new Framework.DataServices.ParameterConfiguration(commonDatabase.GetProvider());


            DataSet dsResult = commonDatabase.ExecuteDataSet(
                CommandType.Text,
                "SELECT * FROM Users WHERE Children > @Children", false, CurrentUser,
                parameterConfig.Create("@Children", DbType.Int32, ParameterDirection.Input, 0));
        }
        public void FailedToExecuteTextToDataSetInWrongFieldName()
        {
            Framework.DataServices.CommonDatabase commonDatabase =
                new Framework.DataServices.CommonDatabase(ConnectionName, ConnectionString, ProviderName);


            Framework.DataServices.ParameterConfiguration parameterConfig =
                new Framework.DataServices.ParameterConfiguration(commonDatabase.GetProvider());


            DataSet dsResult = commonDatabase.ExecuteDataSet(
                CommandType.Text,
                "SELECT * FROM Users_Fail " +
                " WHERE Children > @Children " +
                "   AND BirthDateFail < @BirthDate ", false, CurrentUser,
                parameterConfig.Create("@Children", DbType.Int32, ParameterDirection.Input, 1),
                parameterConfig.Create("@BirthDate", DbType.Date, ParameterDirection.Input, DateTime.Now));
        }