Skip to content

Commit

Permalink
removed redundant ctor
Browse files Browse the repository at this point in the history
  • Loading branch information
Oliver Tomlinson committed Jul 27, 2023
1 parent f4ac24a commit ef4f74c
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 21 deletions.
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"dotnet-test-explorer.testProjectPath": "**/*Tests.csproj"
"dotnet-test-explorer.testProjectPath": "**/*Tests.csproj",
"dotnet-test-explorer.treeMode": "flat"
}
14 changes: 0 additions & 14 deletions UnitTests/ErrorHandlingTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,6 @@ namespace Tests;
[TestClass]
public class ErrorHandlingTests
{
[TestMethod]
[ExpectedException(typeof(InvalidOperationException),
"Call 'InitAsync' firs")]
public async Task MustCallInitBeforeUsingTheDatabaseHelper()
{
var pgsqlFactory = Substitute.For<IPgsqlFactory>();
var h = new StateStoreInitHelper(pgsqlFactory, Substitute.For<ILogger>());

var operationMetadata = new Dictionary<string,string>();

h.TenantAwareDatabaseFactory?.Invoke(operationMetadata, null);
Assert.Fail();
}

[TestMethod]
[ExpectedException(typeof(StateStoreInitHelperException),
"Mandatory component metadata property 'connectionString' is not set")]
Expand Down
6 changes: 0 additions & 6 deletions src/StateStoreInitHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,6 @@ public class StateStoreInitHelper
public Func<IReadOnlyDictionary<string, string>, NpgsqlConnection, Pgsql>? TenantAwareDatabaseFactory { get; private set; }

private string _connectionString;

public StateStoreInitHelper(IPgsqlFactory pgsqlFactory, ILogger logger){
_pgsqlFactory = pgsqlFactory;
_logger = logger;
TenantAwareDatabaseFactory = (_,_) => { throw new InvalidOperationException("Call 'InitAsync' first"); };
}

public StateStoreInitHelper(IPgsqlFactory pgsqlFactory, ILogger logger, IReadOnlyDictionary<string,string> componentMetadataProperties){
_pgsqlFactory = pgsqlFactory;
Expand Down

0 comments on commit ef4f74c

Please sign in to comment.