Skip to content

Commit

Permalink
test: throw exception when tenant id is missing for when using databa…
Browse files Browse the repository at this point in the history
…se per tenant
  • Loading branch information
AlexZeitler authored and jeremydmiller committed Jun 4, 2024
1 parent 5c69422 commit c8f1941
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions src/MultiTenancyTests/using_database_per_tenant.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
using System;
using System.Threading.Tasks;
using Marten;
using Marten.Testing.Harness;
using Shouldly;
using Xunit.Abstractions;

namespace MultiTenancyTests;

public class using_database_per_tenant: IAsyncLifetime
{
private readonly ITestOutputHelper _testOutputHelper;
private DocumentStore _theStore;

public using_database_per_tenant(
ITestOutputHelper testOutputHelper
) => _testOutputHelper = testOutputHelper;

public async Task InitializeAsync()
{
_theStore = DocumentStore.For(
options =>
{
options.MultiTenantedWithSingleServer(ConnectionSource.ConnectionString);
}
);
}

[Fact]
public async Task should_not_meaning_ful_exception_when_tenant_id_is_missing()
{
Should.Throw<ArgumentNullException>(() => _theStore.LightweightSession());
}


public async Task DisposeAsync() => await _theStore.DisposeAsync();
}

0 comments on commit c8f1941

Please sign in to comment.