Skip to content

Commit

Permalink
Add possibility to pass Options to MongoReplicaSetResource (#142)
Browse files Browse the repository at this point in the history
  • Loading branch information
glucaci authored Sep 25, 2024
1 parent 2d32333 commit e789b03
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 10 deletions.
2 changes: 1 addition & 1 deletion global.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"sdk": {
"version": "7.0.400",
"version": "8.0.304",
"rollForward": "minor"
}
}
2 changes: 1 addition & 1 deletion src/Dependencies.props
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
</PropertyGroup>

<PropertyGroup Label="Framework Versions">
<TestProjectTargetFrameworks>net6.0;net7.0</TestProjectTargetFrameworks>
<TestProjectTargetFrameworks>net6.0;net7.0;net8.0</TestProjectTargetFrameworks>
<ResourceProjectTargetFrameworks>netstandard2.0;net6.0;net7.0</ResourceProjectTargetFrameworks>
</PropertyGroup>
</Project>
2 changes: 1 addition & 1 deletion src/Mongo/MongoReplicaSetDefaultOptions.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
namespace Squadron
{
/// <summary>
/// Default Mongo ResplicaSet resource options
/// Default Mongo ReplicaSet resource options
/// </summary>
public class MongoReplicaSetDefaultOptions : MongoDefaultOptions
{
Expand Down
11 changes: 8 additions & 3 deletions src/Mongo/MongoReplicaSetResource.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,18 @@

namespace Squadron
{
/// <inheritdoc/>
public class MongoReplicaSetResource : MongoReplicaSetResource<MongoReplicaSetDefaultOptions> { }

/// <summary>
/// Represents a mongo database resplica set resource that can be used by unit tests.
/// Represents a mongo database replica set resource that can be used by unit tests.
/// </summary>
/// <seealso cref="IDisposable"/>
public class MongoReplicaSetResource : MongoResource<MongoReplicaSetDefaultOptions>
public class MongoReplicaSetResource<TOptions> :
MongoResource<TOptions>
where TOptions : MongoReplicaSetDefaultOptions, new()
{
public async override Task InitializeAsync()
public override async Task InitializeAsync()
{
await base.InitializeAsync();
var client = new MongoClient(ConnectionString + "/?connect=direct");
Expand Down
8 changes: 4 additions & 4 deletions src/Mongo/MongoResource.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ public class MongoResource : MongoResource<MongoDefaultOptions> { }
/// Represents a mongo database resource that can be used by unit tests.
/// </summary>
/// <seealso cref="IDisposable"/>
public class MongoResource<TOptions>
: ContainerResource<TOptions>,
IAsyncLifetime,
IComposableResource
public class MongoResource<TOptions> :
ContainerResource<TOptions>,
IAsyncLifetime,
IComposableResource
where TOptions : ContainerResourceOptions, new()
{
private MongoClient _client;
Expand Down

0 comments on commit e789b03

Please sign in to comment.