Skip to content

Commit

Permalink
Remove unnecessary precondition checks (#2129)
Browse files Browse the repository at this point in the history
* Remove unnecessary precondition checks.

The public constructors prevent the object from being in this state.

Signed-off-by: Bradley Grainger <[email protected]>

* Simplify constructor.

Co-authored-by: Adam Sitnik <[email protected]>

---------

Signed-off-by: Bradley Grainger <[email protected]>
Co-authored-by: Adam Sitnik <[email protected]>
  • Loading branch information
bgrainger and adamsitnik authored Dec 18, 2023
1 parent 2621fd5 commit da70571
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions src/HealthChecks.MySql/MySqlHealthCheck.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,7 @@ public class MySqlHealthCheck : IHealthCheck

public MySqlHealthCheck(MySqlHealthCheckOptions options)
{
Guard.ThrowIfNull(options);
if (options.DataSource is null && options.ConnectionString is null)
throw new InvalidOperationException("One of options.DataSource or options.ConnectionString must be specified.");
if (options.DataSource is not null && options.ConnectionString is not null)
throw new InvalidOperationException("Only one of options.DataSource or options.ConnectionString must be specified.");
_options = options;
_options = Guard.ThrowIfNull(options);
}

/// <inheritdoc />
Expand Down

0 comments on commit da70571

Please sign in to comment.