Skip to content

Commit

Permalink
DRY out query translation failure in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
roji committed Nov 17, 2019
1 parent 293dab3 commit 304f7e8
Show file tree
Hide file tree
Showing 4 changed files with 64 additions and 237 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,41 +21,32 @@ public NorthwindAggregateOperatorsQuerySqliteTest(NorthwindQuerySqliteFixture<No
// SQLite client-eval
public override async Task Sum_with_division_on_decimal(bool async)
{
Assert.StartsWith(
"The LINQ expression",
(await Assert.ThrowsAsync<InvalidOperationException>(
() => base.Sum_with_division_on_decimal(async)))
.Message);
await AssertTranslationFailure(() => base.Sum_with_division_on_decimal(async));
}

// SQLite client-eval
public override async Task Sum_with_division_on_decimal_no_significant_digits(bool async)
{
Assert.StartsWith(
"The LINQ expression",
(await Assert.ThrowsAsync<InvalidOperationException>(
() => base.Sum_with_division_on_decimal_no_significant_digits(async)))
.Message);
await AssertTranslationFailure(() => base.Sum_with_division_on_decimal_no_significant_digits(async));
}

// SQLite client-eval
public override async Task Average_with_division_on_decimal(bool async)
{
Assert.StartsWith(
"The LINQ expression",
(await Assert.ThrowsAsync<InvalidOperationException>(
() => base.Average_with_division_on_decimal(async)))
.Message);
await AssertTranslationFailure(() => base.Average_with_division_on_decimal(async));
}

// SQLite client-eval
public override async Task Average_with_division_on_decimal_no_significant_digits(bool async)
{
Assert.StartsWith(
await AssertTranslationFailure(() => base.Average_with_division_on_decimal_no_significant_digits(async));
}

private async Task AssertTranslationFailure(Func<Task> query)
=> Assert.StartsWith(
"The LINQ expression",
(await Assert.ThrowsAsync<InvalidOperationException>(
() => base.Average_with_division_on_decimal_no_significant_digits(async)))
(await Assert.ThrowsAsync<InvalidOperationException>(query))
.Message);
}

}
}
Loading

0 comments on commit 304f7e8

Please sign in to comment.