Skip to content

Commit

Permalink
Fix tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
lauxjpn committed Mar 16, 2024
1 parent a3a0bc7 commit 5a3ffa2
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1583,6 +1583,19 @@ public virtual void DropSequenceOperation()
ignoreLineEndingDifferences: true);
}

[SupportedServerVersionCondition(nameof(ServerVersion.Supports.DefaultExpression), nameof(ServerVersion.Supports.AlternativeDefaultExpression))]
public override void DefaultValue_with_line_breaks_2(bool isUnicode)
{
base.DefaultValue_with_line_breaks_2(isUnicode);

Assert.Equal(
@"CREATE TABLE `TestLineBreaks` (
`TestDefaultValue` longtext NOT NULL DEFAULT (CONCAT('0', CHAR(13, 10), '1', CHAR(13, 10), '2', CHAR(13, 10), '3', CHAR(13, 10), '4', CHAR(13, 10), '5', CHAR(13, 10), '6', CHAR(13, 10), '7', CHAR(13, 10), '8', CHAR(13, 10), '9', CHAR(13, 10), '10', CHAR(13, 10), '11', CHAR(13, 10), '12', CHAR(13, 10), '13', CHAR(13, 10), '14', CHAR(13, 10), '15', CHAR(13, 10), '16', CHAR(13, 10), '17', CHAR(13, 10), '18', CHAR(13, 10), '19', CHAR(13, 10), '20', CHAR(13, 10), '21', CHAR(13, 10), '22', CHAR(13, 10), '23', CHAR(13, 10), '24', CHAR(13, 10), '25', CHAR(13, 10), '26', CHAR(13, 10), '27', CHAR(13, 10), '28', CHAR(13, 10), '29', CHAR(13, 10), '30', CHAR(13, 10), '31', CHAR(13, 10), '32', CHAR(13, 10), '33', CHAR(13, 10), '34', CHAR(13, 10), '35', CHAR(13, 10), '36', CHAR(13, 10), '37', CHAR(13, 10), '38', CHAR(13, 10), '39', CHAR(13, 10), '40', CHAR(13, 10), '41', CHAR(13, 10), '42', CHAR(13, 10), '43', CHAR(13, 10), '44', CHAR(13, 10), '45', CHAR(13, 10), '46', CHAR(13, 10), '47', CHAR(13, 10), '48', CHAR(13, 10), '49', CHAR(13, 10), '50', CHAR(13, 10), '51', CHAR(13, 10), '52', CHAR(13, 10), '53', CHAR(13, 10), '54', CHAR(13, 10), '55', CHAR(13, 10), '56', CHAR(13, 10), '57', CHAR(13, 10), '58', CHAR(13, 10), '59', CHAR(13, 10), '60', CHAR(13, 10), '61', CHAR(13, 10), '62', CHAR(13, 10), '63', CHAR(13, 10), '64', CHAR(13, 10), '65', CHAR(13, 10), '66', CHAR(13, 10), '67', CHAR(13, 10), '68', CHAR(13, 10), '69', CHAR(13, 10), '70', CHAR(13, 10), '71', CHAR(13, 10), '72', CHAR(13, 10), '73', CHAR(13, 10), '74', CHAR(13, 10), '75', CHAR(13, 10), '76', CHAR(13, 10), '77', CHAR(13, 10), '78', CHAR(13, 10), '79', CHAR(13, 10), '80', CHAR(13, 10), '81', CHAR(13, 10), '82', CHAR(13, 10), '83', CHAR(13, 10), '84', CHAR(13, 10), '85', CHAR(13, 10), '86', CHAR(13, 10), '87', CHAR(13, 10), '88', CHAR(13, 10), '89', CHAR(13, 10), '90', CHAR(13, 10), '91', CHAR(13, 10), '92', CHAR(13, 10), '93', CHAR(13, 10), '94', CHAR(13, 10), '95', CHAR(13, 10), '96', CHAR(13, 10), '97', CHAR(13, 10), '98', CHAR(13, 10), '99', CHAR(13, 10), '100', CHAR(13, 10), '101', CHAR(13, 10), '102', CHAR(13, 10), '103', CHAR(13, 10), '104', CHAR(13, 10), '105', CHAR(13, 10), '106', CHAR(13, 10), '107', CHAR(13, 10), '108', CHAR(13, 10), '109', CHAR(13, 10), '110', CHAR(13, 10), '111', CHAR(13, 10), '112', CHAR(13, 10), '113', CHAR(13, 10), '114', CHAR(13, 10), '115', CHAR(13, 10), '116', CHAR(13, 10), '117', CHAR(13, 10), '118', CHAR(13, 10), '119', CHAR(13, 10), '120', CHAR(13, 10), '121', CHAR(13, 10), '122', CHAR(13, 10), '123', CHAR(13, 10), '124', CHAR(13, 10), '125', CHAR(13, 10), '126', CHAR(13, 10), '127', CHAR(13, 10), '128', CHAR(13, 10), '129', CHAR(13, 10), '130', CHAR(13, 10), '131', CHAR(13, 10), '132', CHAR(13, 10), '133', CHAR(13, 10), '134', CHAR(13, 10), '135', CHAR(13, 10), '136', CHAR(13, 10), '137', CHAR(13, 10), '138', CHAR(13, 10), '139', CHAR(13, 10), '140', CHAR(13, 10), '141', CHAR(13, 10), '142', CHAR(13, 10), '143', CHAR(13, 10), '144', CHAR(13, 10), '145', CHAR(13, 10), '146', CHAR(13, 10), '147', CHAR(13, 10), '148', CHAR(13, 10), '149', CHAR(13, 10), '150', CHAR(13, 10), '151', CHAR(13, 10), '152', CHAR(13, 10), '153', CHAR(13, 10), '154', CHAR(13, 10), '155', CHAR(13, 10), '156', CHAR(13, 10), '157', CHAR(13, 10), '158', CHAR(13, 10), '159', CHAR(13, 10), '160', CHAR(13, 10), '161', CHAR(13, 10), '162', CHAR(13, 10), '163', CHAR(13, 10), '164', CHAR(13, 10), '165', CHAR(13, 10), '166', CHAR(13, 10), '167', CHAR(13, 10), '168', CHAR(13, 10), '169', CHAR(13, 10), '170', CHAR(13, 10), '171', CHAR(13, 10), '172', CHAR(13, 10), '173', CHAR(13, 10), '174', CHAR(13, 10), '175', CHAR(13, 10), '176', CHAR(13, 10), '177', CHAR(13, 10), '178', CHAR(13, 10), '179', CHAR(13, 10), '180', CHAR(13, 10), '181', CHAR(13, 10), '182', CHAR(13, 10), '183', CHAR(13, 10), '184', CHAR(13, 10), '185', CHAR(13, 10), '186', CHAR(13, 10), '187', CHAR(13, 10), '188', CHAR(13, 10), '189', CHAR(13, 10), '190', CHAR(13, 10), '191', CHAR(13, 10), '192', CHAR(13, 10), '193', CHAR(13, 10), '194', CHAR(13, 10), '195', CHAR(13, 10), '196', CHAR(13, 10), '197', CHAR(13, 10), '198', CHAR(13, 10), '199', CHAR(13, 10), '200', CHAR(13, 10), '201', CHAR(13, 10), '202', CHAR(13, 10), '203', CHAR(13, 10), '204', CHAR(13, 10), '205', CHAR(13, 10), '206', CHAR(13, 10), '207', CHAR(13, 10), '208', CHAR(13, 10), '209', CHAR(13, 10), '210', CHAR(13, 10), '211', CHAR(13, 10), '212', CHAR(13, 10), '213', CHAR(13, 10), '214', CHAR(13, 10), '215', CHAR(13, 10), '216', CHAR(13, 10), '217', CHAR(13, 10), '218', CHAR(13, 10), '219', CHAR(13, 10), '220', CHAR(13, 10), '221', CHAR(13, 10), '222', CHAR(13, 10), '223', CHAR(13, 10), '224', CHAR(13, 10), '225', CHAR(13, 10), '226', CHAR(13, 10), '227', CHAR(13, 10), '228', CHAR(13, 10), '229', CHAR(13, 10), '230', CHAR(13, 10), '231', CHAR(13, 10), '232', CHAR(13, 10), '233', CHAR(13, 10), '234', CHAR(13, 10), '235', CHAR(13, 10), '236', CHAR(13, 10), '237', CHAR(13, 10), '238', CHAR(13, 10), '239', CHAR(13, 10), '240', CHAR(13, 10), '241', CHAR(13, 10), '242', CHAR(13, 10), '243', CHAR(13, 10), '244', CHAR(13, 10), '245', CHAR(13, 10), '246', CHAR(13, 10), '247', CHAR(13, 10), '248', CHAR(13, 10), '249', CHAR(13, 10), '250', CHAR(13, 10), '251', CHAR(13, 10), '252', CHAR(13, 10), '253', CHAR(13, 10), '254', CHAR(13, 10), '255', CHAR(13, 10), '256', CHAR(13, 10), '257', CHAR(13, 10), '258', CHAR(13, 10), '259', CHAR(13, 10), '260', CHAR(13, 10), '261', CHAR(13, 10), '262', CHAR(13, 10), '263', CHAR(13, 10), '264', CHAR(13, 10), '265', CHAR(13, 10), '266', CHAR(13, 10), '267', CHAR(13, 10), '268', CHAR(13, 10), '269', CHAR(13, 10), '270', CHAR(13, 10), '271', CHAR(13, 10), '272', CHAR(13, 10), '273', CHAR(13, 10), '274', CHAR(13, 10), '275', CHAR(13, 10), '276', CHAR(13, 10), '277', CHAR(13, 10), '278', CHAR(13, 10), '279', CHAR(13, 10), '280', CHAR(13, 10), '281', CHAR(13, 10), '282', CHAR(13, 10), '283', CHAR(13, 10), '284', CHAR(13, 10), '285', CHAR(13, 10), '286', CHAR(13, 10), '287', CHAR(13, 10), '288', CHAR(13, 10), '289', CHAR(13, 10), '290', CHAR(13, 10), '291', CHAR(13, 10), '292', CHAR(13, 10), '293', CHAR(13, 10), '294', CHAR(13, 10), '295', CHAR(13, 10), '296', CHAR(13, 10), '297', CHAR(13, 10), '298', CHAR(13, 10), '299', CHAR(13, 10), ''))
);" + EOL,
Sql,
ignoreLineEndingDifferences: true);
}

protected new void AssertSql(string expected)
{
var testSqlLoggerFactory = new TestSqlLoggerFactory();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,22 @@ ORDER BY `t`.`Name`
LIMIT @__p_0");
}

public override Task Subquery_with_Distinct_Skip_FirstOrDefault_without_OrderBy(bool async)
{
// Since this method is explicitly **not** using OrderBy() before Take(),
// there is no way to guarantee what elements get returned.
// Therefore, it cannot be verified against the "expected" data.
// The only thing that could reliably be verified is the count of the queried entities.
return AssertQuery(
async,
ss => from l1 in ss.Set<Level1>()
where l1.Id < 3
select (from l3 in ss.Set<Level3>()
orderby l3.Id
select l3).Distinct().Skip(1).FirstOrDefault().Name,
elementAsserter: (expected, actual) => { });
}

private void AssertSql(params string[] expected)
=> Fixture.TestSqlLoggerFactory.AssertBaseline(expected);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
using Microsoft.EntityFrameworkCore.Query;
using Microsoft.EntityFrameworkCore.TestUtilities;
using MySqlConnector;
using Pomelo.EntityFrameworkCore.MySql.Infrastructure;
using Pomelo.EntityFrameworkCore.MySql.Tests.TestUtilities.Attributes;
using Xunit;

namespace Pomelo.EntityFrameworkCore.MySql.FunctionalTests.Query
Expand All @@ -14,6 +16,12 @@ public FromSqlQueryMySqlTest(NorthwindQueryMySqlFixture<NoopModelCustomizer> fix
{
}

[SupportedServerVersionCondition(nameof(ServerVersionSupport.ExceptIntercept))]
public override Task Multiple_occurrences_of_FromSql_with_db_parameter_adds_parameter_only_once(bool async)
{
return base.Multiple_occurrences_of_FromSql_with_db_parameter_adds_parameter_only_once(async);
}

protected override DbParameter CreateDbParameter(string name, object value)
=> new MySqlParameter
{
Expand Down

0 comments on commit 5a3ffa2

Please sign in to comment.