示例#1
0
        public async Task TestExecuteStoredProcHelperMethodToNotExecute(string spName)
        {
            // Testing empty dictionary ...
            var parameters = new Dictionary <string, object>();

            var success = await _sp.ExecuteStoredProcHelper(spName, parameters);

            Assert.IsFalse(success);
        }
示例#2
0
        /// <summary>
        /// Entry point for console app
        /// </summary>
        /// <param name="args">Can pass stored proc name as a args parameter</param>
        static void Main(string[] args)
        {
            #region Declarations

            IStoredProcHelper _sp = new StoredProcHelperClass(_db);

            // Stored Proc name
            var spName = args.Length == 0 ? "dbo.usp_MyStoredProc" : args[0];

            // Build a dictionary that is of type <string, object>;
            var parameters = new Dictionary <string, object>
            {
                { "Param1", "Value" },
                { "Param2", 123 },
                { "Param3", DateTime.Now }
            };

            #endregion

            try
            {
                // Invoke the method ...
                _sp.ExecuteStoredProcHelper(spName, parameters);

                Console.ForegroundColor = ConsoleColor.Green;
                Console.WriteLine("Stored Proc Executed Successfully!");

                Console.ReadKey();
            }
            catch (Exception ex)
            {
                // Something went wrong ...
                Console.ForegroundColor = ConsoleColor.Red;
                Console.WriteLine(ex.Message);

                Console.ReadKey();
            }
        }