Skip to content

Commit

Permalink
#963 Fixes for the PGSQL, MYSQL and SQLITE extended libraries
Browse files Browse the repository at this point in the history
  • Loading branch information
mikependon committed Dec 1, 2021
1 parent d0a845d commit 96c57eb
Show file tree
Hide file tree
Showing 10 changed files with 0 additions and 160 deletions.
16 changes: 0 additions & 16 deletions RepoDb.MySql/RepoDb.MySql.UnitTests/StatementBuilderTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -960,22 +960,6 @@ public void TestMySqlStatementBuilderCreateQueryOrderByFieldsMultiDirection()
Assert.AreEqual(expected, query);
}

[TestMethod, ExpectedException(typeof(MissingFieldsException))]
public void ThrowExceptionOnMySqlStatementBuilderCreateQueryIfOrderFieldsAreNotPresentAtTheFields()
{
// Setup
var builder = StatementBuilderMapper.Get<MySqlConnection>();

// Act
builder.CreateQuery(new QueryBuilder(),
"Table",
Field.From("Id", "Name", "Address"),
null,
OrderField.Parse(new { Id = Order.Descending, SSN = Order.Ascending }),
null,
null);
}

[TestMethod, ExpectedException(typeof(NotSupportedException))]
public void ThrowExceptionOnMySqlStatementBuilderCreateQueryIfThereAreHints()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -641,22 +641,6 @@ public override string CreateQuery(QueryBuilder queryBuilder,
throw new NullReferenceException($"The list of queryable fields must not be null for '{tableName}'.");
}

// Validate the ordering
if (orderBy != null)
{
// Check if the order fields are present in the given fields
var unmatchesOrderFields = orderBy.Where(orderField =>
fields.FirstOrDefault(f =>
string.Equals(orderField.Name, f.Name, StringComparison.OrdinalIgnoreCase)) == null);

// Throw an error we found any unmatches
if (unmatchesOrderFields.Any() == true)
{
throw new MissingFieldsException($"The order fields '{unmatchesOrderFields.Select(field => field.Name).Join(", ")}' are not " +
$"present at the given fields '{fields.Select(field => field.Name).Join(", ")}'.");
}
}

// Initialize the builder
var builder = queryBuilder ?? new QueryBuilder();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -960,22 +960,6 @@ public void TestMySqlStatementBuilderCreateQueryOrderByFieldsMultiDirection()
Assert.AreEqual(expected, query);
}

[TestMethod, ExpectedException(typeof(MissingFieldsException))]
public void ThrowExceptionOnMySqlStatementBuilderCreateQueryIfOrderFieldsAreNotPresentAtTheFields()
{
// Setup
var builder = StatementBuilderMapper.Get<MySqlConnection>();

// Act
builder.CreateQuery(new QueryBuilder(),
"Table",
Field.From("Id", "Name", "Address"),
null,
OrderField.Parse(new { Id = Order.Descending, SSN = Order.Ascending }),
null,
null);
}

[TestMethod, ExpectedException(typeof(NotSupportedException))]
public void ThrowExceptionOnMySqlStatementBuilderCreateQueryIfThereAreHints()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -641,22 +641,6 @@ public override string CreateQuery(QueryBuilder queryBuilder,
throw new NullReferenceException($"The list of queryable fields must not be null for '{tableName}'.");
}

// Validate the ordering
if (orderBy != null)
{
// Check if the order fields are present in the given fields
var unmatchesOrderFields = orderBy.Where(orderField =>
fields.FirstOrDefault(f =>
string.Equals(orderField.Name, f.Name, StringComparison.OrdinalIgnoreCase)) == null);

// Throw an error we found any unmatches
if (unmatchesOrderFields.Any() == true)
{
throw new MissingFieldsException($"The order fields '{unmatchesOrderFields.Select(field => field.Name).Join(", ")}' are not " +
$"present at the given fields '{fields.Select(field => field.Name).Join(", ")}'.");
}
}

// Initialize the builder
var builder = queryBuilder ?? new QueryBuilder();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -961,22 +961,6 @@ public void TestPostgreSqlStatementBuilderCreateQueryOrderByFieldsMultiDirection
Assert.AreEqual(expected, query);
}

[TestMethod, ExpectedException(typeof(MissingFieldsException))]
public void ThrowExceptionOnPostgreSqlStatementBuilderCreateQueryIfOrderFieldsAreNotPresentAtTheFields()
{
// Setup
var builder = StatementBuilderMapper.Get<NpgsqlConnection>();

// Act
builder.CreateQuery(new QueryBuilder(),
"Table",
Field.From("Id", "Name", "Address"),
null,
OrderField.Parse(new { Id = Order.Descending, SSN = Order.Ascending }),
null,
null);
}

[TestMethod, ExpectedException(typeof(NotSupportedException))]
public void ThrowExceptionOnPostgreSqlStatementBuilderCreateQueryIfThereAreHints()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -582,22 +582,6 @@ public override string CreateQuery(QueryBuilder queryBuilder,
throw new NullReferenceException($"The list of queryable fields must not be null for '{tableName}'.");
}

// Validate the ordering
if (orderBy != null)
{
// Check if the order fields are present in the given fields
var unmatchesOrderFields = orderBy.Where(orderField =>
fields.FirstOrDefault(f =>
string.Equals(orderField.Name, f.Name, StringComparison.OrdinalIgnoreCase)) == null);

// Throw an error we found any unmatches
if (unmatchesOrderFields.Any() == true)
{
throw new MissingFieldsException($"The order fields '{unmatchesOrderFields.Select(field => field.Name).Join(", ")}' are not " +
$"present at the given fields '{fields.Select(field => field.Name).Join(", ")}'.");
}
}

// Initialize the builder
var builder = queryBuilder ?? new QueryBuilder();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -731,22 +731,6 @@ public void TestSdsSqLiteStatementBuilderCreateQueryOrderByFieldsMultiDirection(
Assert.AreEqual(expected, query);
}

[TestMethod, ExpectedException(typeof(MissingFieldsException))]
public void ThrowExceptionOnSqLiteStatementBuilderCreateQueryIfOrderFieldsAreNotPresentAtTheFields()
{
// Setup
var builder = StatementBuilderMapper.Get<SQLiteConnection>();

// Act
builder.CreateQuery(new QueryBuilder(),
"Table",
Field.From("Id", "Name", "Address"),
null,
OrderField.Parse(new { Id = Order.Descending, SSN = Order.Ascending }),
null,
null);
}

[TestMethod, ExpectedException(typeof(NotSupportedException))]
public void ThrowExceptionOnSqLiteStatementBuilderCreateQueryIfThereAreHints()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -540,22 +540,6 @@ public override string CreateQuery(QueryBuilder queryBuilder,
throw new NullReferenceException($"The list of queryable fields must not be null for '{tableName}'.");
}

// Validate the ordering
if (orderBy != null)
{
// Check if the order fields are present in the given fields
var unmatchesOrderFields = orderBy.Where(orderField =>
fields.FirstOrDefault(f =>
string.Equals(orderField.Name, f.Name, StringComparison.OrdinalIgnoreCase)) == null);

// Throw an error we found any unmatches
if (unmatchesOrderFields.Any() == true)
{
throw new MissingFieldsException($"The order fields '{unmatchesOrderFields.Select(field => field.Name).Join(", ")}' are not " +
$"present at the given fields '{fields.Select(field => field.Name).Join(", ")}'.");
}
}

// Initialize the builder
var builder = queryBuilder ?? new QueryBuilder();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -731,22 +731,6 @@ public void TestMdsSqLiteStatementBuilderCreateQueryOrderByFieldsMultiDirection(
Assert.AreEqual(expected, query);
}

[TestMethod, ExpectedException(typeof(MissingFieldsException))]
public void ThrowExceptionOnMdsSqLiteStatementBuilderCreateQueryIfOrderFieldsAreNotPresentAtTheFields()
{
// Setup
var builder = StatementBuilderMapper.Get<SqliteConnection>();

// Act
builder.CreateQuery(new QueryBuilder(),
"Table",
Field.From("Id", "Name", "Address"),
null,
OrderField.Parse(new { Id = Order.Descending, SSN = Order.Ascending }),
null,
null);
}

[TestMethod, ExpectedException(typeof(NotSupportedException))]
public void ThrowExceptionOnMdsSqLiteStatementBuilderCreateQueryIfThereAreHints()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -540,22 +540,6 @@ public override string CreateQuery(QueryBuilder queryBuilder,
throw new NullReferenceException($"The list of queryable fields must not be null for '{tableName}'.");
}

// Validate the ordering
if (orderBy != null)
{
// Check if the order fields are present in the given fields
var unmatchesOrderFields = orderBy.Where(orderField =>
fields.FirstOrDefault(f =>
string.Equals(orderField.Name, f.Name, StringComparison.OrdinalIgnoreCase)) == null);

// Throw an error we found any unmatches
if (unmatchesOrderFields.Any() == true)
{
throw new MissingFieldsException($"The order fields '{unmatchesOrderFields.Select(field => field.Name).Join(", ")}' are not " +
$"present at the given fields '{fields.Select(field => field.Name).Join(", ")}'.");
}
}

// Initialize the builder
var builder = queryBuilder ?? new QueryBuilder();

Expand Down

0 comments on commit 96c57eb

Please sign in to comment.