public void AddParameterDouble()
        {
            SqlCommandBuilder command;

            // Test Double argument only.
            command = new SqlCommandBuilder("GetTaxon");
            command.AddParameter("RowCount", 32.43);
            Assert.AreEqual(command.GetCommand(), "EXECUTE GetTaxon @RowCount = 32.43");

            // Test Double argument last in argument list.
            command = new SqlCommandBuilder("GetTaxon");
            command.AddParameter("RowCount", 52365);
            command.AddParameter("TcpIp", 100.0);
            Assert.AreEqual(command.GetCommand(), "EXECUTE GetTaxon @RowCount = 52365, @TcpIp = 100");

            // Test Double argument first in argument list.
            command = new SqlCommandBuilder("GetTaxon");
            command.AddParameter("TcpIp", 100.3);
            command.AddParameter("RowCount", 52300);
            Assert.AreEqual(command.GetCommand(), "EXECUTE GetTaxon @TcpIp = 100.3, @RowCount = 52300");

            // Test Double argument inside argument list.
            command = new SqlCommandBuilder("GetTaxon");
            command.AddParameter("TcpIp", 52);
            command.AddParameter("RowCount", 222.222);
            command.AddParameter("SqlServerUser", "En vanlig kommentar");
            Assert.AreEqual(command.GetCommand(), "EXECUTE GetTaxon @TcpIp = 52, @RowCount = 222.222, @SqlServerUser = N'En vanlig kommentar'");
        }
        public void AddParameterInt32()
        {
            SqlCommandBuilder command;

            // Test Int32 argument only.
            command = new SqlCommandBuilder("GetTaxon");
            command.AddParameter("RowCount", 32);
            Assert.AreEqual(command.GetCommand(), "EXECUTE GetTaxon @RowCount = 32");

            // Test Int32 argument last in argument list.
            command = new SqlCommandBuilder("GetTaxon");
            command.AddParameter("SqlServerUser", "lklgkj gsldfkg slk");
            command.AddParameter("RowCount", 42);
            Assert.AreEqual(command.GetCommand(), "EXECUTE GetTaxon @SqlServerUser = N'lklgkj gsldfkg slk', @RowCount = 42");

            // Test Int32 argument first in argument list.
            command = new SqlCommandBuilder("GetTaxon");
            command.AddParameter("RowCount", 101);
            command.AddParameter("SqlServerUser", "lklgkj gsldfkg slk");
            Assert.AreEqual(command.GetCommand(), "EXECUTE GetTaxon @RowCount = 101, @SqlServerUser = N'lklgkj gsldfkg slk'");

            // Test Int32 argument inside argument list.
            command = new SqlCommandBuilder("GetTaxon");
            command.AddParameter("TcpIp", true);
            command.AddParameter("RowCount", 10134);
            command.AddParameter("SqlServerUser", "lklgkj gsldfkg slk");
            Assert.AreEqual(command.GetCommand(), "EXECUTE GetTaxon @TcpIp = 1, @RowCount = 10134, @SqlServerUser = N'lklgkj gsldfkg slk'");
        }
        public void AddParameterDateTime()
        {
            SqlCommandBuilder command;

            // Test DateTime argument only.
            command = new SqlCommandBuilder("GetTaxon");
            command.AddParameter("Time", new DateTime(2008, 11, 11, 15, 12, 14));
            Assert.AreEqual(command.GetCommand(), "EXECUTE GetTaxon @Time = '2008-11-11 15:12:14.000'");

            // Test DateTime argument last in argument list.
            command = new SqlCommandBuilder("GetTaxon");
            command.AddParameter("RowCount", 52365);
            command.AddParameter("Time", new DateTime(2008, 11, 14, 20, 10, 14));
            Assert.AreEqual(command.GetCommand(), "EXECUTE GetTaxon @RowCount = 52365, @Time = '2008-11-14 20:10:14.000'");

            // Test DateTime argument first in argument list.
            command = new SqlCommandBuilder("GetTaxon");
            command.AddParameter("Time", new DateTime(2008, 11, 14, 20, 10, 33));
            command.AddParameter("RowCount", 52300);
            Assert.AreEqual(command.GetCommand(), "EXECUTE GetTaxon @Time = '2008-11-14 20:10:33.000', @RowCount = 52300");

            // Test DateTime argument inside argument list.
            command = new SqlCommandBuilder("GetTaxon");
            command.AddParameter("RowCount", 52);
            command.AddParameter("Time", new DateTime(1888, 11, 14, 20, 10, 33));
            command.AddParameter("SqlServerUser", "En vanlig kommentar");
            Assert.AreEqual(command.GetCommand(), "EXECUTE GetTaxon @RowCount = 52, @Time = '1888-11-14 20:10:33.000', @SqlServerUser = N'En vanlig kommentar'");
        }
        public void AddParameterNullableInt64()
        {
            SqlCommandBuilder command;

            // Test null Int64 argument only.
            command = new SqlCommandBuilder("GetTaxon");
            command.AddParameter("RowCount", (Int64?)null);
            Assert.AreEqual(command.GetCommand(), "EXECUTE GetTaxon @RowCount = NULL");

            // Test Int64 argument only.
            command = new SqlCommandBuilder("GetTaxon");
            command.AddParameter("RowCount", (Int64?)32123456789123);
            Assert.AreEqual(command.GetCommand(), "EXECUTE GetTaxon @RowCount = 32123456789123");

            // Test Int64 argument last in argument list.
            command = new SqlCommandBuilder("GetTaxon");
            command.AddParameter("SqlServerUser", "lklgkj gsldfkg slk");
            command.AddParameter("RowCount", (Int64?)32123456789123);
            Assert.AreEqual(command.GetCommand(), "EXECUTE GetTaxon @SqlServerUser = N'lklgkj gsldfkg slk', @RowCount = 32123456789123");

            // Test Int64 argument first in argument list.
            command = new SqlCommandBuilder("GetTaxon");
            command.AddParameter("RowCount", (Int64?)32123456789123);
            command.AddParameter("SqlServerUser", "lklgkj gsldfkg slk");
            Assert.AreEqual(command.GetCommand(), "EXECUTE GetTaxon @RowCount = 32123456789123, @SqlServerUser = N'lklgkj gsldfkg slk'");

            // Test Int64 argument inside argument list.
            command = new SqlCommandBuilder("GetTaxon");
            command.AddParameter("TcpIp", true);
            command.AddParameter("RowCount", (Int64?)32123456789125);
            command.AddParameter("SqlServerUser", "lklgkj gsldfkg slk");
            Assert.AreEqual(command.GetCommand(), "EXECUTE GetTaxon @TcpIp = 1, @RowCount = 32123456789125, @SqlServerUser = N'lklgkj gsldfkg slk'");
        }
        public void AddParameterDateTime()
        {
            SqlCommandBuilder command;

            // Test DateTime argument only.
            command = new SqlCommandBuilder("GetTaxon");
            command.AddParameter(TaxonData.SORT_ORDER, new DateTime(2008, 11, 11, 15, 12, 14));
            Assert.AreEqual(command.GetCommand(), "EXECUTE GetTaxon @SortOrder = '2008-11-11 15:12:14.000'");

            // Test DateTime argument last in argument list.
            command = new SqlCommandBuilder("GetTaxon");
            command.AddParameter(TaxonData.ID, 52365);
            command.AddParameter(TaxonData.SORT_ORDER, new DateTime(2008, 11, 14, 20, 10, 14));
            Assert.AreEqual(command.GetCommand(), "EXECUTE GetTaxon @Id = 52365, @SortOrder = '2008-11-14 20:10:14.000'");

            // Test DateTime argument first in argument list.
            command = new SqlCommandBuilder("GetTaxon");
            command.AddParameter(TaxonData.SORT_ORDER, new DateTime(2008, 11, 14, 20, 10, 33));
            command.AddParameter(TaxonData.ID, 52300);
            Assert.AreEqual(command.GetCommand(), "EXECUTE GetTaxon @SortOrder = '2008-11-14 20:10:33.000', @Id = 52300");

            // Test DateTime argument inside argument list.
            command = new SqlCommandBuilder("GetTaxon");
            command.AddParameter(TaxonData.ID, 52);
            command.AddParameter(TaxonData.SORT_ORDER, new DateTime(1888, 11, 14, 20, 10, 33));
            command.AddParameter(TaxonData.SCIENTIFIC_NAME, "En vanlig kommentar");
            Assert.AreEqual(command.GetCommand(), "EXECUTE GetTaxon @Id = 52, @SortOrder = '1888-11-14 20:10:33.000', @ScientificName = 'En vanlig kommentar'");
        }
        public void AddParameterBoolean()
        {
            SqlCommandBuilder command;

            // Test Boolean argument only.
            command = new SqlCommandBuilder("GetTaxon");
            command.AddParameter("RowCount", false);
            Assert.AreEqual(command.GetCommand(), "EXECUTE GetTaxon @RowCount = 0");

            // Test Boolean argument last in argument list.
            command = new SqlCommandBuilder("GetTaxon");
            command.AddParameter("WebServiceUser", "%DEV%");
            command.AddParameter("SqlServerUser", true);
            Assert.AreEqual(command.GetCommand(), "EXECUTE GetTaxon @WebServiceUser = N'%DEV%', @SqlServerUser = 1");

            // Test Boolean argument first in argument list.
            command = new SqlCommandBuilder("GetTaxon");
            command.AddParameter("SqlServerUser", false);
            command.AddParameter("WebServiceUser", "%Hej%");
            Assert.AreEqual(command.GetCommand(), "EXECUTE GetTaxon @SqlServerUser = 0, @WebServiceUser = N'%Hej%'");

            // Test Boolean argument inside argument list.
            command = new SqlCommandBuilder("GetTaxon");
            command.AddParameter("TcpIp", "gfdgsdgsg%");
            command.AddParameter("WebServiceUser", true);
            command.AddParameter("SqlServerUser", 123654);
            Assert.AreEqual(command.GetCommand(), "EXECUTE GetTaxon @TcpIp = N'gfdgsdgsg%', @WebServiceUser = 1, @SqlServerUser = 123654");
        }
        public void AddParameterBoolean()
        {
            SqlCommandBuilder command;

            // Test Boolean argument only.
            command = new SqlCommandBuilder("GetTaxon");
            command.AddParameter(TaxonData.SCIENTIFIC_NAME, false);
            Assert.AreEqual(command.GetCommand(), "EXECUTE GetTaxon @ScientificName = 0");

            // Test Boolean argument last in argument list.
            command = new SqlCommandBuilder("GetTaxon");
            command.AddParameter(TaxonData.ID, "%DEV%");
            command.AddParameter(TaxonData.SCIENTIFIC_NAME, true);
            Assert.AreEqual(command.GetCommand(), "EXECUTE GetTaxon @Id = '%DEV%', @ScientificName = 1");

            // Test Boolean argument first in argument list.
            command = new SqlCommandBuilder("GetTaxon");
            command.AddParameter(TaxonData.SCIENTIFIC_NAME, false);
            command.AddParameter(TaxonData.TAXON_TYPE_ID, "%Hej%");
            Assert.AreEqual(command.GetCommand(), "EXECUTE GetTaxon @ScientificName = 0, @TaxonTypeId = '%Hej%'");

            // Test Boolean argument inside argument list.
            command = new SqlCommandBuilder("GetTaxon");
            command.AddParameter(TaxonData.TAXON_TYPE_ID, "gfdgsdgsg%");
            command.AddParameter(TaxonData.SCIENTIFIC_NAME, true);
            command.AddParameter(TaxonData.ID, 123654);
            Assert.AreEqual(command.GetCommand(), "EXECUTE GetTaxon @TaxonTypeId = 'gfdgsdgsg%', @ScientificName = 1, @Id = 123654");
        }
        public void AddParameterString()
        {
            SqlCommandBuilder command;

            // Test String argument only.
            command = new SqlCommandBuilder("GetTaxon");
            command.AddParameter(TaxonData.SCIENTIFIC_NAME, "Konstigt taxon det här");
            Assert.AreEqual(command.GetCommand(), "EXECUTE GetTaxon @ScientificName = 'Konstigt taxon det här'");

            // Test String argument last in argument list.
            command = new SqlCommandBuilder("GetTaxon");
            command.AddParameter(TaxonData.ID, 234);
            command.AddParameter(TaxonData.SCIENTIFIC_NAME, "Konstigt taxon det här");
            Assert.AreEqual(command.GetCommand(), "EXECUTE GetTaxon @Id = 234, @ScientificName = 'Konstigt taxon det här'");

            // Test String argument first in argument list.
            command = new SqlCommandBuilder("GetTaxon");
            command.AddParameter(TaxonData.SCIENTIFIC_NAME, "Konstigt taxon det här");
            command.AddParameter(TaxonData.ID, 555234);
            Assert.AreEqual(command.GetCommand(), "EXECUTE GetTaxon @ScientificName = 'Konstigt taxon det här', @Id = 555234");

            // Test String argument inside argument list.
            command = new SqlCommandBuilder("GetTaxon");
            command.AddParameter(TaxonData.ID, 234);
            command.AddParameter(TaxonData.SCIENTIFIC_NAME, "Konstigt taxon det här");
            command.AddParameter(TaxonData.TAXON_TYPE_ID, false);
            Assert.AreEqual(command.GetCommand(), "EXECUTE GetTaxon @Id = 234, @ScientificName = 'Konstigt taxon det här', @TaxonTypeId = 0");
        }
        public void AddParameterInt64()
        {
            SqlCommandBuilder command;

            // Test Int64 argument only.
            command = new SqlCommandBuilder("GetTaxon");
            command.AddParameter(TaxonData.ID, 32123456789123);
            Assert.AreEqual(command.GetCommand(), "EXECUTE GetTaxon @Id = 32123456789123");

            // Test Int64 argument last in argument list.
            command = new SqlCommandBuilder("GetTaxon");
            command.AddParameter(TaxonData.SCIENTIFIC_NAME, "lklgkj gsldfkg slk");
            command.AddParameter(TaxonData.ID, 3212345345489123);
            Assert.AreEqual(command.GetCommand(), "EXECUTE GetTaxon @ScientificName = 'lklgkj gsldfkg slk', @Id = 3212345345489123");

            // Test Int64 argument first in argument list.
            command = new SqlCommandBuilder("GetTaxon");
            command.AddParameter(TaxonData.ID, 3214235345489123);
            command.AddParameter(TaxonData.SCIENTIFIC_NAME, "lklgkj gsldfkg slk");
            Assert.AreEqual(command.GetCommand(), "EXECUTE GetTaxon @Id = 3214235345489123, @ScientificName = 'lklgkj gsldfkg slk'");

            // Test Int64 argument inside argument list.
            command = new SqlCommandBuilder("GetTaxon");
            command.AddParameter(TaxonData.TAXON_TYPE_ID, true);
            command.AddParameter(TaxonData.ID, 3214235347654649123);
            command.AddParameter(TaxonData.SCIENTIFIC_NAME, "lklgkj gsldfkg slk");
            Assert.AreEqual(command.GetCommand(), "EXECUTE GetTaxon @TaxonTypeId = 1, @Id = 3214235347654649123, @ScientificName = 'lklgkj gsldfkg slk'");
        }
        public void AddParameterInt32()
        {
            SqlCommandBuilder command;

            // Test Int32 argument only.
            command = new SqlCommandBuilder("GetTaxon");
            command.AddParameter(TaxonData.ID, 32);
            Assert.AreEqual(command.GetCommand(), "EXECUTE GetTaxon @Id = 32");

            // Test Int32 argument last in argument list.
            command = new SqlCommandBuilder("GetTaxon");
            command.AddParameter(TaxonData.SCIENTIFIC_NAME, "lklgkj gsldfkg slk");
            command.AddParameter(TaxonData.ID, 42);
            Assert.AreEqual(command.GetCommand(), "EXECUTE GetTaxon @ScientificName = 'lklgkj gsldfkg slk', @Id = 42");

            // Test Int32 argument first in argument list.
            command = new SqlCommandBuilder("GetTaxon");
            command.AddParameter(TaxonData.ID, 101);
            command.AddParameter(TaxonData.SCIENTIFIC_NAME, "lklgkj gsldfkg slk");
            Assert.AreEqual(command.GetCommand(), "EXECUTE GetTaxon @Id = 101, @ScientificName = 'lklgkj gsldfkg slk'");

            // Test Int32 argument inside argument list.
            command = new SqlCommandBuilder("GetTaxon");
            command.AddParameter(TaxonData.TAXON_TYPE_ID, true);
            command.AddParameter(TaxonData.ID, 10134);
            command.AddParameter(TaxonData.SCIENTIFIC_NAME, "lklgkj gsldfkg slk");
            Assert.AreEqual(command.GetCommand(), "EXECUTE GetTaxon @TaxonTypeId = 1, @Id = 10134, @ScientificName = 'lklgkj gsldfkg slk'");
        }
        public void AddParameterDouble()
        {
            SqlCommandBuilder command;

            // Test Double argument only.
            command = new SqlCommandBuilder("GetTaxon");
            command.AddParameter(TaxonData.SORT_ORDER, 32.43);
            Assert.AreEqual(command.GetCommand(), "EXECUTE GetTaxon @SortOrder = 32.43");

            // Test Double argument last in argument list.
            command = new SqlCommandBuilder("GetTaxon");
            command.AddParameter(TaxonData.ID, 52365);
            command.AddParameter(TaxonData.SORT_ORDER, 100.0);
            Assert.AreEqual(command.GetCommand(), "EXECUTE GetTaxon @Id = 52365, @SortOrder = 100");

            // Test Double argument first in argument list.
            command = new SqlCommandBuilder("GetTaxon");
            command.AddParameter(TaxonData.SORT_ORDER, 100.3);
            command.AddParameter(TaxonData.ID, 52300);
            Assert.AreEqual(command.GetCommand(), "EXECUTE GetTaxon @SortOrder = 100.3, @Id = 52300");

            // Test Double argument inside argument list.
            command = new SqlCommandBuilder("GetTaxon");
            command.AddParameter(TaxonData.ID, 52);
            command.AddParameter(TaxonData.SORT_ORDER, 222.222);
            command.AddParameter(TaxonData.SCIENTIFIC_NAME, "En vanlig kommentar");
            Assert.AreEqual(command.GetCommand(), "EXECUTE GetTaxon @Id = 52, @SortOrder = 222.222, @ScientificName = 'En vanlig kommentar'");
        }
        public void AddParameterString()
        {
            SqlCommandBuilder command;

            // Test String argument only.
            command = new SqlCommandBuilder("GetTaxon");
            command.AddParameter("SqlServerUser", "Konstigt taxon det här");
            Assert.AreEqual(command.GetCommand(), "EXECUTE GetTaxon @SqlServerUser = N'Konstigt taxon det här'");

            // Test String argument last in argument list.
            command = new SqlCommandBuilder("GetTaxon");
            command.AddParameter("RowCount", 234);
            command.AddParameter("SqlServerUser", "Konstigt taxon det här");
            Assert.AreEqual(command.GetCommand(), "EXECUTE GetTaxon @RowCount = 234, @SqlServerUser = N'Konstigt taxon det här'");

            // Test String argument first in argument list.
            command = new SqlCommandBuilder("GetTaxon");
            command.AddParameter("SqlServerUser", "Konstigt taxon det här");
            command.AddParameter("RowCount", 555234);
            Assert.AreEqual(command.GetCommand(), "EXECUTE GetTaxon @SqlServerUser = N'Konstigt taxon det här', @RowCount = 555234");

            // Test String argument inside argument list.
            command = new SqlCommandBuilder("GetTaxon");
            command.AddParameter("RowCount", 234);
            command.AddParameter("SqlServerUser", "Konstigt taxon det här");
            command.AddParameter("TcpIp", false);
            Assert.AreEqual(command.GetCommand(), "EXECUTE GetTaxon @RowCount = 234, @SqlServerUser = N'Konstigt taxon det här', @TcpIp = 0");

            // Test String argument with ' and parameter as text.
            command = new SqlCommandBuilder("GetTaxon");
            command.AddParameter("TaxonName", "Foo''Bar");
            Assert.AreEqual(command.GetCommand(), "EXECUTE GetTaxon @TaxonName = N'Foo''Bar'");

            // Test String argument with ' and parameter as text and dynamic SQL is used in stored procedure.
            command = new SqlCommandBuilder("GetTaxon");
            command.AddParameter("TaxonName", "Foo''Bar", 1);
            Assert.AreEqual(command.GetCommand(), "EXECUTE GetTaxon @TaxonName = N'Foo''Bar'");
            command = new SqlCommandBuilder("GetTaxon");
            command.AddParameter("TaxonName", "Foo''Bar", 2);
            Assert.AreEqual(command.GetCommand(), "EXECUTE GetTaxon @TaxonName = N'Foo''''Bar'");
            command = new SqlCommandBuilder("GetTaxon");
            command.AddParameter("TaxonName", "Foo''Bar", 3);
            Assert.AreEqual(command.GetCommand(), "EXECUTE GetTaxon @TaxonName = N'Foo''''''''Bar'");
        }