Example #1
0
        public override async Task Union_Skip_Take_OrderBy_ThenBy_Where(bool isAsync)
        {
            await base.Union_Skip_Take_OrderBy_ThenBy_Where(isAsync);

            AssertSql(
                $@"{AssertSqlHelper.Declaration("@__p_0='0'")}

SELECT `t0`.`CustomerID`, `t0`.`Address`, `t0`.`City`, `t0`.`CompanyName`, `t0`.`ContactName`, `t0`.`ContactTitle`, `t0`.`Country`, `t0`.`Fax`, `t0`.`Phone`, `t0`.`PostalCode`, `t0`.`Region`
FROM (
    SELECT `t`.`CustomerID`, `t`.`Address`, `t`.`City`, `t`.`CompanyName`, `t`.`ContactName`, `t`.`ContactTitle`, `t`.`Country`, `t`.`Fax`, `t`.`Phone`, `t`.`PostalCode`, `t`.`Region`
    FROM (
        SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region`
        FROM `Customers` AS `c`
        WHERE `c`.`City` = 'Berlin'
        UNION
        SELECT `c0`.`CustomerID`, `c0`.`Address`, `c0`.`City`, `c0`.`CompanyName`, `c0`.`ContactName`, `c0`.`ContactTitle`, `c0`.`Country`, `c0`.`Fax`, `c0`.`Phone`, `c0`.`PostalCode`, `c0`.`Region`
        FROM `Customers` AS `c0`
        WHERE `c0`.`City` = 'London'
    ) AS `t`
    ORDER BY `t`.`Region`, `t`.`City`
    SKIP {AssertSqlHelper.Parameter("@__p_0")}
) AS `t0`
WHERE CHARINDEX('Thomas', `t0`.`ContactName`) > 0
ORDER BY `t0`.`Region`, `t0`.`City`");
        }
Example #2
0
        public override void RequiredAttribute_for_navigation_throws_while_inserting_null_value()
        {
            base.RequiredAttribute_for_navigation_throws_while_inserting_null_value();

            AssertSql(
                $@"@p0=NULL (DbType = Int32)
{AssertSqlHelper.Declaration("@p1='1'")}

SET NOCOUNT ON;
INSERT INTO `BookDetails` (`AdditionalBookDetailsId`, `AnotherBookId`)
VALUES ({AssertSqlHelper.Parameter("@p0")}, {AssertSqlHelper.Parameter("@p1")});
SELECT `Id`
FROM `BookDetails`
WHERE @@ROWCOUNT = 1 AND `Id` = scope_identity();",
                //
                $@"@p0=NULL (DbType = Int32)
@p1=NULL (Nullable = false) (DbType = Int32)

SET NOCOUNT ON;
INSERT INTO `BookDetails` (`AdditionalBookDetailsId`, `AnotherBookId`)
VALUES ({AssertSqlHelper.Parameter("@p0")}, {AssertSqlHelper.Parameter("@p1")});
SELECT `Id`
FROM `BookDetails`
WHERE @@ROWCOUNT = 1 AND `Id` = scope_identity();");
        }
Example #3
0
        public override void FromSqlInterpolated_parameterization_issue_12213()
        {
            base.FromSqlInterpolated_parameterization_issue_12213();

            AssertSql(
                $@"p0='10300'

SELECT * FROM ""Orders"" WHERE ""OrderID"" >= {AssertSqlHelper.Parameter("@p0")}",
                //
                $@"{AssertSqlHelper.Declaration("@__max_0='10400'")}

p0='10300'

SELECT `o`.`OrderID`
FROM `Orders` AS `o`
WHERE (`o`.`OrderID` <= {AssertSqlHelper.Parameter("@__max_0")}) AND `o`.`OrderID` IN (
    SELECT `o0`.`OrderID`
    FROM (
        SELECT * FROM ""Orders"" WHERE ""OrderID"" >= {AssertSqlHelper.Parameter("@p0")}
    ) AS `o0`
)",
                //
                $@"{AssertSqlHelper.Declaration("@__max_0='10400'")}

p0='10300'

SELECT `o`.`OrderID`
FROM `Orders` AS `o`
WHERE (`o`.`OrderID` <= {AssertSqlHelper.Parameter("@__max_0")}) AND `o`.`OrderID` IN (
    SELECT `o0`.`OrderID`
    FROM (
        SELECT * FROM ""Orders"" WHERE ""OrderID"" >= {AssertSqlHelper.Parameter("@p0")}
    ) AS `o0`
)");
        }
Example #4
0
        public override void FromSqlInterpolated_queryable_multiple_composed_with_parameters_and_closure_parameters_interpolated()
        {
            base.FromSqlInterpolated_queryable_multiple_composed_with_parameters_and_closure_parameters_interpolated();

            AssertSql(
                $@"p0='London' (Size = 4000)
p1='1997-01-01T00:00:00'
p2='1998-01-01T00:00:00'

SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region`, `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate`
FROM (
    SELECT * FROM ""Customers"" WHERE ""City"" = {AssertSqlHelper.Parameter("@p0")}
) AS `c`,
(
    SELECT * FROM ""Orders"" WHERE ""OrderDate"" BETWEEN {AssertSqlHelper.Parameter("@p1")} AND {AssertSqlHelper.Parameter("@p2")}
) AS `o`
WHERE `c`.`CustomerID` = `o`.`CustomerID`",
                //
                $@"p0='Berlin' (Size = 4000)
p1='1998-04-01T00:00:00'
p2='1998-05-01T00:00:00'

SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region`, `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate`
FROM (
    SELECT * FROM ""Customers"" WHERE ""City"" = {AssertSqlHelper.Parameter("@p0")}
) AS `c`,
(
    SELECT * FROM ""Orders"" WHERE ""OrderDate"" BETWEEN {AssertSqlHelper.Parameter("@p1")} AND {AssertSqlHelper.Parameter("@p2")}
) AS `o`
WHERE `c`.`CustomerID` = `o`.`CustomerID`");
        }
Example #5
0
        public override async Task Select_Union_different_fields_in_anonymous_with_subquery(bool isAsync)
        {
            await base.Select_Union_different_fields_in_anonymous_with_subquery(isAsync);

            AssertSql(
                $@"{AssertSqlHelper.Declaration("@__p_0='1'")}

{AssertSqlHelper.Declaration("@__p_1='10'")}

SELECT `t0`.`Foo`, `t0`.`CustomerID`, `t0`.`Address`, `t0`.`City`, `t0`.`CompanyName`, `t0`.`ContactName`, `t0`.`ContactTitle`, `t0`.`Country`, `t0`.`Fax`, `t0`.`Phone`, `t0`.`PostalCode`, `t0`.`Region`
FROM (
    SELECT `t`.`Foo`, `t`.`CustomerID`, `t`.`Address`, `t`.`City`, `t`.`CompanyName`, `t`.`ContactName`, `t`.`ContactTitle`, `t`.`Country`, `t`.`Fax`, `t`.`Phone`, `t`.`PostalCode`, `t`.`Region`
    FROM (
        SELECT `c`.`City` AS `Foo`, `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region`
        FROM `Customers` AS `c`
        WHERE `c`.`City` = 'Berlin'
        UNION
        SELECT `c0`.`Region` AS `Foo`, `c0`.`CustomerID`, `c0`.`Address`, `c0`.`City`, `c0`.`CompanyName`, `c0`.`ContactName`, `c0`.`ContactTitle`, `c0`.`Country`, `c0`.`Fax`, `c0`.`Phone`, `c0`.`PostalCode`, `c0`.`Region`
        FROM `Customers` AS `c0`
        WHERE `c0`.`City` = 'London'
    ) AS `t`
    ORDER BY `t`.`Foo`
    SKIP {AssertSqlHelper.Parameter("@__p_0")} FETCH NEXT {AssertSqlHelper.Parameter("@__p_1")} ROWS ONLY
) AS `t0`
WHERE `t0`.`Foo` = 'Berlin'
ORDER BY `t0`.`Foo`");
        }
Example #6
0
        public override void Save_replaced_principal()
        {
            base.Save_replaced_principal();

            AssertSql(
                $@"SELECT TOP 2 `c`.`Id`, `c`.`Name`, `c`.`PrincipalId`
FROM `Categories` AS `c`",
                //
                $@"{AssertSqlHelper.Declaration("@__category_PrincipalId_0='778' (Nullable = true)")}

SELECT `p`.`Id`, `p`.`DependentId`, `p`.`Name`, `p`.`Price`
FROM `Products` AS `p`
WHERE `p`.`DependentId` = {AssertSqlHelper.Parameter("@__category_PrincipalId_0")}",
                //
                $@"{AssertSqlHelper.Declaration("@p1='78'")}

{AssertSqlHelper.Declaration("@p0='New Category' (Size = 4000)")}

SET NOCOUNT ON;
UPDATE `Categories` SET `Name` = {AssertSqlHelper.Parameter("@p0")}
WHERE `Id` = {AssertSqlHelper.Parameter("@p1")};
SELECT @@ROWCOUNT;",
                //
                $@"SELECT TOP 2 `c`.`Id`, `c`.`Name`, `c`.`PrincipalId`
FROM `Categories` AS `c`",
                //
                $@"{AssertSqlHelper.Declaration("@__category_PrincipalId_0='778' (Nullable = true)")}

SELECT `p`.`Id`, `p`.`DependentId`, `p`.`Name`, `p`.`Price`
FROM `Products` AS `p`
WHERE `p`.`DependentId` = {AssertSqlHelper.Parameter("@__category_PrincipalId_0")}");
        }
Example #7
0
        public override void Property_entry_original_value_is_set()
        {
            base.Property_entry_original_value_is_set();

            AssertSql(
                $@"SELECT TOP 1 `e`.`Id`, `e`.`EngineSupplierId`, `e`.`Name`, `t`.`Id`, `t`.`StorageLocation_Latitude`, `t`.`StorageLocation_Longitude`
FROM `Engines` AS `e`
LEFT JOIN (
    SELECT `e0`.`Id`, `e0`.`StorageLocation_Latitude`, `e0`.`StorageLocation_Longitude`, `e1`.`Id` AS `Id0`
    FROM `Engines` AS `e0`
    INNER JOIN `Engines` AS `e1` ON `e0`.`Id` = `e1`.`Id`
    WHERE `e0`.`StorageLocation_Longitude` IS NOT NULL AND `e0`.`StorageLocation_Latitude` IS NOT NULL
) AS `t` ON `e`.`Id` = `t`.`Id`
ORDER BY `e`.`Id`",
                //
                $@"{AssertSqlHelper.Declaration("@p1='1'")}

{AssertSqlHelper.Declaration("@p2='1'")}

{AssertSqlHelper.Declaration("@p0='FO 108X' (Size = 4000)")}

{AssertSqlHelper.Declaration("@p3='ChangedEngine' (Size = 4000)")}

{AssertSqlHelper.Declaration("@p4='47.64491'")}

{AssertSqlHelper.Declaration("@p5='-122.128101'")}

SET NOCOUNT ON;
UPDATE `Engines` SET `Name` = {AssertSqlHelper.Parameter("@p0")}
WHERE `Id` = {AssertSqlHelper.Parameter("@p1")} AND `EngineSupplierId` = {AssertSqlHelper.Parameter("@p2")} AND `Name` = {AssertSqlHelper.Parameter("@p3")} AND `StorageLocation_Latitude` = {AssertSqlHelper.Parameter("@p4")} AND `StorageLocation_Longitude` = {AssertSqlHelper.Parameter("@p5")};
SELECT @@ROWCOUNT;");
        }
Example #8
0
        public virtual void FromSqlRaw_in_subquery_with_positional_dbParameter_with_name()
        {
            using (var context = CreateContext())
            {
                var actual = context.Orders.Where(
                    o =>
                    context.Customers
                    .FromSqlRaw(
                        @"SELECT * FROM ""Customers"" WHERE ""City"" = {0}",
                        // ReSharper disable once FormatStringProblem
                        new OleDbParameter("@city", "London"))
                    .Select(c => c.CustomerID)
                    .Contains(o.CustomerID))
                             .ToArray();

                Assert.Equal(46, actual.Length);

                AssertSql(
                    $@"{AssertSqlHelper.Declaration("@city='London' (Nullable = false) (Size = 6)")}

SELECT `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate`
FROM `Orders` AS `o`
WHERE `o`.`CustomerID` IN (
    SELECT `c`.`CustomerID`
    FROM (
        SELECT * FROM ""Customers"" WHERE ""City"" = {AssertSqlHelper.Parameter("@city")}
    ) AS `c`
)");
            }
        }
Example #9
0
        public override void DbContext_property_based_filter_does_not_short_circuit()
        {
            base.DbContext_property_based_filter_does_not_short_circuit();

            AssertSql(
                $@"{AssertSqlHelper.Declaration("@__ef_filter__p_0='False'")}

{AssertSqlHelper.Declaration("@__ef_filter__IsModerated_1='True' (Nullable = true)")}

SELECT `s`.`Id`, `s`.`IsDeleted`, `s`.`IsModerated`
FROM `ShortCircuitFilter` AS `s`
WHERE (`s`.`IsDeleted` <> True) AND (({AssertSqlHelper.Parameter("@__ef_filter__p_0")} = True) OR ({AssertSqlHelper.Parameter("@__ef_filter__IsModerated_1")} = `s`.`IsModerated`))",
                //
                $@"{AssertSqlHelper.Declaration("@__ef_filter__p_0='False'")}

{AssertSqlHelper.Declaration("@__ef_filter__IsModerated_1='False' (Nullable = true)")}

SELECT `s`.`Id`, `s`.`IsDeleted`, `s`.`IsModerated`
FROM `ShortCircuitFilter` AS `s`
WHERE (`s`.`IsDeleted` <> True) AND (({AssertSqlHelper.Parameter("@__ef_filter__p_0")} = True) OR ({AssertSqlHelper.Parameter("@__ef_filter__IsModerated_1")} = `s`.`IsModerated`))",
                //
                $@"{AssertSqlHelper.Declaration("@__ef_filter__p_0='True'")}

SELECT `s`.`Id`, `s`.`IsDeleted`, `s`.`IsModerated`
FROM `ShortCircuitFilter` AS `s`
WHERE (`s`.`IsDeleted` <> True) AND ({AssertSqlHelper.Parameter("@__ef_filter__p_0")} = True)");
        }
Example #10
0
        public override void DbContext_complex_expression_is_parameterized()
        {
            base.DbContext_complex_expression_is_parameterized();

            AssertSql(
                $@"{AssertSqlHelper.Declaration("@__ef_filter__Property_0='False'")}

{AssertSqlHelper.Declaration("@__ef_filter__p_1='True'")}

SELECT `c`.`Id`, `c`.`IsEnabled`
FROM `ComplexFilter` AS `c`
WHERE (`c`.`IsEnabled` = {AssertSqlHelper.Parameter("@__ef_filter__Property_0")}) AND ({AssertSqlHelper.Parameter("@__ef_filter__p_1")} = True)",
                //
                $@"{AssertSqlHelper.Declaration("@__ef_filter__Property_0='True'")}

{AssertSqlHelper.Declaration("@__ef_filter__p_1='True'")}

SELECT `c`.`Id`, `c`.`IsEnabled`
FROM `ComplexFilter` AS `c`
WHERE (`c`.`IsEnabled` = {AssertSqlHelper.Parameter("@__ef_filter__Property_0")}) AND ({AssertSqlHelper.Parameter("@__ef_filter__p_1")} = True)",
                //
                $@"{AssertSqlHelper.Declaration("@__ef_filter__Property_0='True'")}

{AssertSqlHelper.Declaration("@__ef_filter__p_1='False'")}

SELECT `c`.`Id`, `c`.`IsEnabled`
FROM `ComplexFilter` AS `c`
WHERE (`c`.`IsEnabled` = {AssertSqlHelper.Parameter("@__ef_filter__Property_0")}) AND ({AssertSqlHelper.Parameter("@__ef_filter__p_1")} = True)");
        }
Example #11
0
        public override void Navs_query()
        {
            base.Navs_query();

            AssertSql(
                $@"{AssertSqlHelper.Declaration("@__ef_filter__TenantPrefix_0='B' (Size = 4000)")}

{AssertSqlHelper.Declaration("@__ef_filter___quantity_1='50'")}

SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region`
FROM `Customers` AS `c`
INNER JOIN (
    SELECT `o`.`OrderID`, `o`.`CustomerID`, `o`.`EmployeeID`, `o`.`OrderDate`
    FROM `Orders` AS `o`
    LEFT JOIN (
        SELECT `c0`.`CustomerID`, `c0`.`Address`, `c0`.`City`, `c0`.`CompanyName`, `c0`.`ContactName`, `c0`.`ContactTitle`, `c0`.`Country`, `c0`.`Fax`, `c0`.`Phone`, `c0`.`PostalCode`, `c0`.`Region`
        FROM `Customers` AS `c0`
        WHERE ({AssertSqlHelper.Parameter("@__ef_filter__TenantPrefix_0")} = '') OR (`c0`.`CompanyName` IS NOT NULL AND (LEFT(`c0`.`CompanyName`, LEN({AssertSqlHelper.Parameter("@__ef_filter__TenantPrefix_0")})) = {AssertSqlHelper.Parameter("@__ef_filter__TenantPrefix_0")}))
    ) AS `t` ON `o`.`CustomerID` = `t`.`CustomerID`
    WHERE `t`.`CustomerID` IS NOT NULL AND `t`.`CompanyName` IS NOT NULL
) AS `t0` ON `c`.`CustomerID` = `t0`.`CustomerID`
INNER JOIN (
    SELECT `o0`.`OrderID`, `o0`.`ProductID`, `o0`.`Discount`, `o0`.`Quantity`, `o0`.`UnitPrice`
    FROM `Order Details` AS `o0`
    WHERE `o0`.`Quantity` > {AssertSqlHelper.Parameter("@__ef_filter___quantity_1")}
) AS `t1` ON `t0`.`OrderID` = `t1`.`OrderID`
WHERE (({AssertSqlHelper.Parameter("@__ef_filter__TenantPrefix_0")} = '') OR (`c`.`CompanyName` IS NOT NULL AND (LEFT(`c`.`CompanyName`, LEN({AssertSqlHelper.Parameter("@__ef_filter__TenantPrefix_0")})) = {AssertSqlHelper.Parameter("@__ef_filter__TenantPrefix_0")}))) AND (`t1`.`Discount` < IIf(10 IS NULL, NULL, CSNG(10)))");
        }
Example #12
0
        public override async Task Union_Take_Union_Take(bool isAsync)
        {
            await base.Union_Take_Union_Take(isAsync);

            AssertSql(
                $@"{AssertSqlHelper.Declaration("@__p_0='1'")}

SELECT `t2`.`CustomerID`, `t2`.`Address`, `t2`.`City`, `t2`.`CompanyName`, `t2`.`ContactName`, `t2`.`ContactTitle`, `t2`.`Country`, `t2`.`Fax`, `t2`.`Phone`, `t2`.`PostalCode`, `t2`.`Region`
FROM (
    SELECT TOP {AssertSqlHelper.Parameter("@__p_0")} `t1`.`CustomerID`, `t1`.`Address`, `t1`.`City`, `t1`.`CompanyName`, `t1`.`ContactName`, `t1`.`ContactTitle`, `t1`.`Country`, `t1`.`Fax`, `t1`.`Phone`, `t1`.`PostalCode`, `t1`.`Region`
    FROM (
        SELECT `t0`.`CustomerID`, `t0`.`Address`, `t0`.`City`, `t0`.`CompanyName`, `t0`.`ContactName`, `t0`.`ContactTitle`, `t0`.`Country`, `t0`.`Fax`, `t0`.`Phone`, `t0`.`PostalCode`, `t0`.`Region`
        FROM (
            SELECT TOP {AssertSqlHelper.Parameter("@__p_0")} `t`.`CustomerID`, `t`.`Address`, `t`.`City`, `t`.`CompanyName`, `t`.`ContactName`, `t`.`ContactTitle`, `t`.`Country`, `t`.`Fax`, `t`.`Phone`, `t`.`PostalCode`, `t`.`Region`
            FROM (
                SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region`
                FROM `Customers` AS `c`
                WHERE `c`.`City` = 'Berlin'
                UNION
                SELECT `c0`.`CustomerID`, `c0`.`Address`, `c0`.`City`, `c0`.`CompanyName`, `c0`.`ContactName`, `c0`.`ContactTitle`, `c0`.`Country`, `c0`.`Fax`, `c0`.`Phone`, `c0`.`PostalCode`, `c0`.`Region`
                FROM `Customers` AS `c0`
                WHERE `c0`.`City` = 'London'
            ) AS `t`
            ORDER BY `t`.`CustomerID`
        ) AS `t0`
        UNION
        SELECT `c1`.`CustomerID`, `c1`.`Address`, `c1`.`City`, `c1`.`CompanyName`, `c1`.`ContactName`, `c1`.`ContactTitle`, `c1`.`Country`, `c1`.`Fax`, `c1`.`Phone`, `c1`.`PostalCode`, `c1`.`Region`
        FROM `Customers` AS `c1`
        WHERE `c1`.`City` = 'Mannheim'
    ) AS `t1`
) AS `t2`
ORDER BY `t2`.`CustomerID`");
        }
Example #13
0
        public override void FromSqlRaw_with_dbParameter_without_name_prefix()
        {
            base.FromSqlRaw_with_dbParameter_without_name_prefix();
            AssertSql(
                $@"city='London' (Nullable = false) (Size = 6)

SELECT * FROM ""Customers"" WHERE ""City"" = {AssertSqlHelper.Parameter("@city")}");
        }
Example #14
0
        public override void FromSqlRaw_queryable_with_null_parameter()
        {
            base.FromSqlRaw_queryable_with_null_parameter();

            AssertSql(
                $@"p0=NULL (Nullable = false)

SELECT * FROM ""Employees"" WHERE ""ReportsTo"" = {AssertSqlHelper.Parameter("@p0")} OR (""ReportsTo"" IS NULL AND {AssertSqlHelper.Parameter("@p0")} IS NULL)");
        }
        public override void Executes_stored_procedure_with_parameter()
        {
            base.Executes_stored_procedure_with_parameter();

            AssertSql(
                $@"{AssertSqlHelper.Declaration("@CustomerID='ALFKI' (Nullable = false) (Size = 5)")}

`CustOrderHist` @CustomerID");
        }
        public override void Query_with_positional_dbParameter_without_name()
        {
            base.Query_with_positional_dbParameter_without_name();

            AssertSql(
                $@"{AssertSqlHelper.Declaration("@p0='London' (Nullable = false) (Size = 6)")}

SELECT COUNT(*) FROM ""Customers"" WHERE ""City"" = {AssertSqlHelper.Parameter("@p0")}");
        }
        public override async Task From_sql_queryable_stored_procedure_with_parameter_composed_on_client(bool async)
        {
            await base.From_sql_queryable_stored_procedure_with_parameter_composed_on_client(async);

            AssertSql(
                $@"p0='ALFKI' (Size = 4000)

`CustOrderHist` {AssertSqlHelper.Parameter("@CustomerID")} = {AssertSqlHelper.Parameter("@p0")}");
        }
Example #18
0
        public override void FromSqlRaw_with_dbParameter()
        {
            base.FromSqlRaw_with_dbParameter();

            AssertSql(
                $@"{AssertSqlHelper.Declaration("@city='London' (Nullable = false) (Size = 6)")}

SELECT * FROM ""Customers"" WHERE ""City"" = {AssertSqlHelper.Parameter("@city")}");
        }
Example #19
0
        public override void FromSqlRaw_does_not_parameterize_interpolated_string()
        {
            base.FromSqlRaw_does_not_parameterize_interpolated_string();

            AssertSql(
                $@"p0='10250'

SELECT * FROM ""Orders"" WHERE ""OrderID"" < {AssertSqlHelper.Parameter("@p0")}");
        }
        public override void Executes_stored_procedure_with_generated_parameter()
        {
            base.Executes_stored_procedure_with_generated_parameter();

            AssertSql(
                $@"{AssertSqlHelper.Declaration("@p0='ALFKI' (Size = 4000)")}

`CustOrderHist` @CustomerID = {AssertSqlHelper.Parameter("@p0")}");
        }
Example #21
0
        public override void FromSqlInterpolated_with_inlined_db_parameter_without_name_prefix()
        {
            base.FromSqlInterpolated_with_inlined_db_parameter_without_name_prefix();

            AssertSql(
                $@"somename='ALFKI' (Nullable = false) (Size = 5)

SELECT * FROM ""Customers"" WHERE ""CustomerID"" = {AssertSqlHelper.Parameter("@somename")}");
        }
        public override async Task Select_bool_closure_with_order_parameter_with_cast_to_nullable(bool isAsync)
        {
            await base.Select_bool_closure_with_order_parameter_with_cast_to_nullable(isAsync);

            AssertSql(
                $@"{AssertSqlHelper.Declaration("@__boolean_0='False'")}

SELECT {AssertSqlHelper.Parameter("@__boolean_0")}
FROM `Customers` AS `c`");
        }
        public override async Task Select_local(bool isAsync)
        {
            await base.Select_local(isAsync);

            AssertSql(
                $@"{AssertSqlHelper.Declaration("@__x_0='10'")}

SELECT {AssertSqlHelper.Parameter("@__x_0")}
FROM `Customers` AS `c`");
        }
        public override async Task Select_scalar_primitive_after_take(bool isAsync)
        {
            await base.Select_scalar_primitive_after_take(isAsync);

            AssertSql(
                $@"{AssertSqlHelper.Declaration("@__p_0='9'")}

SELECT TOP {AssertSqlHelper.Parameter("@__p_0")} `e`.`EmployeeID`
FROM `Employees` AS `e`");
        }
Example #25
0
        public override void FromSqlInterpolated_queryable_with_parameters_inline_interpolated()
        {
            base.FromSqlInterpolated_queryable_with_parameters_inline_interpolated();

            AssertSql(
                $@"p0='London' (Size = 4000)
p1='Sales Representative' (Size = 4000)

SELECT * FROM ""Customers"" WHERE ""City"" = {AssertSqlHelper.Parameter("@p0")} AND ""ContactTitle"" = {AssertSqlHelper.Parameter("@p1")}");
        }
        public override void Scalar_Function_Constant_Parameter_Static()
        {
            base.Scalar_Function_Constant_Parameter_Static();

            AssertSql(
                $@"{AssertSqlHelper.Declaration("@__customerId_0='1'")}

SELECT `CustomerOrderCount`({AssertSqlHelper.Parameter("@__customerId_0")})
FROM `Customers` AS `c`");
        }
Example #27
0
        public override void Compiled_query_when_does_not_end_in_query_operator()
        {
            base.Compiled_query_when_does_not_end_in_query_operator();

            AssertSql(
                $@"{AssertSqlHelper.Declaration("@__customerID='ALFKI' (Size = 5)")}

SELECT COUNT(*)
FROM `Customers` AS `c`
WHERE `c`.`CustomerID` = {AssertSqlHelper.Parameter("@__customerID")}");
        }
        public override void Scalar_Function_Anonymous_Type_Select_Parameter_Static()
        {
            base.Scalar_Function_Anonymous_Type_Select_Parameter_Static();

            AssertSql(
                $@"{AssertSqlHelper.Declaration("@__customerId_0='1'")}

SELECT TOP 2 `c`.`LastName`, `CustomerOrderCount`({AssertSqlHelper.Parameter("@__customerId_0")}) AS `OrderCount`
FROM `Customers` AS `c`
WHERE `c`.`Id` = {AssertSqlHelper.Parameter("@__customerId_0")}");
        }
        public override void Scalar_Function_Let_Not_Parameter_Instance()
        {
            base.Scalar_Function_Let_Not_Parameter_Instance();

            AssertSql(
                $@"{AssertSqlHelper.Declaration("@__customerId_1='2'")}

SELECT TOP 2 `c`.`LastName`, `CustomerOrderCount`({AssertSqlHelper.Parameter("@__customerId_1")}) AS `OrderCount`
FROM `Customers` AS `c`
WHERE `c`.`Id` = {AssertSqlHelper.Parameter("@__customerId_1")}");
        }
        public override void Scalar_Function_Where_Parameter_Instance()
        {
            base.Scalar_Function_Where_Parameter_Instance();

            AssertSql(
                $@"{AssertSqlHelper.Declaration("@__period_1='0'")}

SELECT TOP 2 `c`.`Id`
FROM `Customers` AS `c`
WHERE `c`.`Id` = `GetCustomerWithMostOrdersAfterDate`(`GetReportingPeriodStartDate`({AssertSqlHelper.Parameter("@__period_1")}))");
        }