public async Task ExecuteNonQueryAll_WithOutputParametersAndMultiOut_ExecutesSuccessfully()
        {
            SqlProgram <int, Out <int>, Out <int> > program =
                await SqlProgram <int, Out <int>, Out <int> > .Create(
                    new LoadBalancedConnection(LocalDatabaseConnectionString, LocalDatabaseCopyConnectionString),
                    "spOutputParameters");

            const int inputVal       = 123;
            const int inputOutputVal = 321;

            MultiOut <int> inputOutput = new MultiOut <int>(inputOutputVal);
            MultiOut <int> output      = new MultiOut <int>();

            int[] nonQueryResult = program.ExecuteNonQueryAll(inputVal, inputOutput, output).ToArray();
            Assert.AreEqual(2, nonQueryResult.Length);
            Assert.IsTrue(nonQueryResult.All(i => i == -1));

            Assert.IsNull(inputOutput.OutputError, inputOutput.OutputError?.Message);
            Assert.IsNull(output.OutputError, output.OutputError?.Message);

            Assert.AreEqual(inputOutputVal * 2, inputOutput.OutputValue.Value);
            Assert.AreEqual(inputVal, output.OutputValue.Value);

            Assert.IsTrue(inputOutput.All(o => o.OutputValue.Value == inputOutputVal * 2));
            Assert.IsTrue(output.All(o => o.OutputValue.Value == inputVal));
        }
        public async Task  ExecuteNonQueryAll_ExecutesSuccessfully()
        {
            SqlProgram nonQueryTest =
                await SqlProgram.Create(connection : new LoadBalancedConnection(LocalDatabaseConnectionString, LocalDatabaseCopyConnectionString),
                                        name : "spNonQuery");

            List <int> nonQueryResult = nonQueryTest.ExecuteNonQueryAll().ToList();

            Assert.AreEqual(2, nonQueryResult.Count);

            foreach (int result in nonQueryResult)
            {
                Assert.AreEqual(-1, result);
            }
        }
        public async Task ExecuteNonQueryAll_WithOutputParametersAndOut_ThrowsArgumentException()
        {
            SqlProgram <int, Out <int>, Out <int> > program =
                await SqlProgram <int, Out <int>, Out <int> > .Create(
                    new LoadBalancedConnection(LocalDatabaseConnectionString, LocalDatabaseCopyConnectionString),
                    "spOutputParameters");

            const int inputVal       = 123;
            const int inputOutputVal = 321;

            Out <int> inputOutput = new Out <int>(inputOutputVal);
            Out <int> output      = new Out <int>();

            program.ExecuteNonQueryAll(inputVal, inputOutput, output);
        }
        public async Task ExecuteNonQueryAll_WithUnknownProgramForConnection_ThrowsLoggingException()
        {
            SqlProgram <string, int> nonQueryTest =
                await SqlProgram <string, int> .Create(connection : new LoadBalancedConnection(LocalDatabaseConnectionString, DifferentLocalDatabaseConnectionString),
                                                       name : "spNonQuery");

            string randomString = Random.RandomString();
            int    randomInt    = Random.RandomInt32();

            nonQueryTest.ExecuteNonQueryAll(
                c =>
            {
                c.SetParameter("@stringParam", randomString);
                c.SetParameter("@intParam", randomInt);
            });
        }
        public async Task ExecuteNonQueryAll_WithParameters_ExecutesSuccessfully()
        {
            SqlProgram <string, int> nonQueryTest =
                await SqlProgram <string, int> .Create(connection : new LoadBalancedConnection(LocalDatabaseConnectionString, LocalDatabaseCopyConnectionString),
                                                       name : "spNonQuery");

            string randomString = Random.RandomString(20);
            int    randomInt    = Random.RandomInt32();

            List <int> nonQueryResult = nonQueryTest.ExecuteNonQueryAll(
                c =>
            {
                c.SetParameter("@stringParam", randomString);
                c.SetParameter("@intParam", randomInt);
            }).ToList();

            Assert.AreEqual(2, nonQueryResult.Count);

            foreach (int result in nonQueryResult)
            {
                Assert.AreEqual(-1, result);
            }
        }