diff --git a/.github/workflows/on-push-do-ci-build-pg15-jsonnet.yml b/.github/workflows/on-push-do-ci-build-pg15-jsonnet.yml index 80d6d62be4..d88170238b 100644 --- a/.github/workflows/on-push-do-ci-build-pg15-jsonnet.yml +++ b/.github/workflows/on-push-do-ci-build-pg15-jsonnet.yml @@ -153,4 +153,4 @@ jobs: - name: test-aspnet-core if: ${{ success() || failure() }} run: ./build.sh test-aspnet-core - shell: bash + shell: bash \ No newline at end of file diff --git a/.github/workflows/on-push-do-ci-build-pgLatest-systemtextjson.yml b/.github/workflows/on-push-do-ci-build-pgLatest-systemtextjson.yml index 25818c1eb2..50ed2d84f5 100644 --- a/.github/workflows/on-push-do-ci-build-pgLatest-systemtextjson.yml +++ b/.github/workflows/on-push-do-ci-build-pgLatest-systemtextjson.yml @@ -153,4 +153,4 @@ jobs: - name: test-aspnet-core if: ${{ success() || failure() }} run: ./build.sh test-aspnet-core - shell: bash + shell: bash \ No newline at end of file diff --git a/azure-pipelines.yml b/azure-pipelines.yml deleted file mode 100644 index 68ee5e6a54..0000000000 --- a/azure-pipelines.yml +++ /dev/null @@ -1,207 +0,0 @@ -trigger: - batch: true - branches: - include: - - master - paths: - exclude: - - docs/* - - documentation/* - - .github/* - -pr: - - master - -resources: - containers: - - container: pg12_plv8 - image: ionx/postgres-plv8:12.8 - ports: - - 5432:5432 - env: - POSTGRES_HOST_AUTH_METHOD: trust - NAMEDATALEN: 150 - user: postgres - - container: pg15 - image: postgres:15-alpine - ports: - - 5432:5432 - env: - POSTGRES_HOST_AUTH_METHOD: trust - NAMEDATALEN: 150 - user: postgres - - container: pgLatest - image: postgres:latest - ports: - - 5432:5432 - env: - POSTGRES_HOST_AUTH_METHOD: trust - NAMEDATALEN: 150 - user: postgres - -variables: - DOTNET_CLI_TELEMETRY_OPTOUT: 1 - DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1 - node_version: 16.x - pg_db: marten_testing - CONFIGURATION: Release - FRAMEWORK: net6.0 - DISABLE_TEST_PARALLELIZATION: true - CONNECTION_STRING: "Host=localhost;Port=5432;Database=marten_testing;Username=postgres;Password=Password12!;Timeout=60;Cancellation Timeout=5000; Command Timeout=60" - NUKE_TELEMETRY_OPTOUT: true - -jobs: - - job: build_dotnet - displayName: build_net6.0 - # timeoutInMinutes: 20 - pool: - vmImage: 'ubuntu-latest' - strategy: - matrix: - pg12_plv8: - postgresService: pg12_plv8 - serializer: Newtonsoft - plv8: true - pg12_SystemTextJson: - postgresService: pg12_plv8 - serializer: SystemTextJson - plv8: true - pg15: - postgresService: pg15 - serializer: SystemTextJson - plv8: false - pgLatest: - postgresService: pgLatest - serializer: Newtonsoft - plv8: false - services: - postgres: $[ variables['postgresService'] ] - steps: - - task: UseDotNet@2 - displayName: Install .NET 6.0.x - inputs: - packageType: 'sdk' - version: '6.x' - - task: UseDotNet@2 - displayName: Install .NET 7.0.x - inputs: - packageType: 'sdk' - version: '7.x' - - task: UseDotNet@2 - displayName: Install .NET 8.0.x - inputs: - packageType: 'sdk' - version: '8.x' - - script: | - dotnet workload update - dotnet workload install aspire - displayName: Install .NET Aspire workload - - task: UseNode@1 - displayName: Install Node.js - inputs: - version: $(node_version) - - script: | - PG_CONTAINER_NAME=$(docker ps --filter expose=5432/tcp --format {{.Names}}) - docker exec $PG_CONTAINER_NAME psql -U postgres -c "create database $(pg_db);" - displayName: Create db - - script: | - PG_CONTAINER_NAME=$(docker ps --filter expose=5432/tcp --format {{.Names}}) - docker exec $PG_CONTAINER_NAME bash -c "echo -e '\nfsync = off' >> /var/lib/postgresql/data/postgresql.conf" - docker exec $PG_CONTAINER_NAME bash -c "echo -e '\nfull_page_writes = off' >> /var/lib/postgresql/data/postgresql.conf" - docker exec $PG_CONTAINER_NAME bash -c "echo -e '\nsynchronous_commit = off' >> /var/lib/postgresql/data/postgresql.conf" - docker container restart $PG_CONTAINER_NAME - displayName: Optimize database for running tests faster - - script: | - PG_CONTAINER_NAME=$(docker ps --filter expose=5432/tcp --format {{.Names}}) - docker exec $PG_CONTAINER_NAME psql -U postgres -d $(pg_db) -c "create extension if not exists plv8;" - docker exec $PG_CONTAINER_NAME psql -U postgres -c "DO 'plv8.elog(NOTICE, plv8.version);' LANGUAGE plv8;" - displayName: Add plv8 extension - condition: eq(variables['plv8'], 'true') - - script: ./build.sh compile - displayName: compile - env: - DEFAULT_SERIALIZER: $(serializer) - - script: ./build.sh mocha - displayName: mocha - continueOnError: true - env: - DEFAULT_SERIALIZER: $(serializer) - - script: ./build.sh test-base-lib - displayName: test-base-lib - continueOnError: true - env: - DEFAULT_SERIALIZER: $(serializer) - - script: ./build.sh test-core - displayName: test-core - continueOnError: true - env: - DEFAULT_SERIALIZER: $(serializer) - - script: ./build.sh test-document-db - displayName: test-document-db - continueOnError: true - env: - DEFAULT_SERIALIZER: $(serializer) - - script: ./build.sh test-event-sourcing - displayName: test-event-sourcing - continueOnError: true - env: - DEFAULT_SERIALIZER: $(serializer) - - script: ./build.sh test-cli - displayName: test-cli - continueOnError: true - env: - DEFAULT_SERIALIZER: $(serializer) - - script: ./build.sh test-core - displayName: test-core - continueOnError: true - env: - DEFAULT_SERIALIZER: $(serializer) - - script: ./build.sh test-linq - displayName: test-linq - continueOnError: true - env: - DEFAULT_SERIALIZER: $(serializer) - # - script: ./build.sh test-multi-tenancy - # displayName: test-multi-tenancy - # continueOnError: true - # env: - # DEFAULT_SERIALIZER: $(serializer) - - script: ./build.sh test-patching - displayName: test-patching - continueOnError: true - env: - DEFAULT_SERIALIZER: $(serializer) - - script: ./build.sh test-value-types - displayName: test-value-types - continueOnError: true - env: - DEFAULT_SERIALIZER: $(serializer) - - script: ./build.sh test-code-gen - displayName: test-code-gen - continueOnError: true - env: - DEFAULT_SERIALIZER: $(serializer) - - script: ./build.sh test-noda-time - displayName: test-noda-time - continueOnError: true - env: - DEFAULT_SERIALIZER: $(serializer) - - script: ./build.sh test-aspnet-core - displayName: test-aspnet-core - continueOnError: true - env: - DEFAULT_SERIALIZER: $(serializer) - - script: ./build.sh test-plv8 - displayName: test-plv8 - continueOnError: true - env: - DEFAULT_SERIALIZER: $(serializer) - condition: eq(variables['plv8'], 'true') - # This step will fail the job if the any previous step had failed - - script: | - if [ $(Agent.JobStatus) == 'SucceededWithIssues' ]; then - exit 1 - fi - name: CheckForFailure - condition: always() - diff --git a/src/CoreTests/Bugs/Bug_3083_concurrent_type_generation.cs b/src/CoreTests/Bugs/Bug_3083_concurrent_type_generation.cs index d3f07e7120..435ce2d23c 100644 --- a/src/CoreTests/Bugs/Bug_3083_concurrent_type_generation.cs +++ b/src/CoreTests/Bugs/Bug_3083_concurrent_type_generation.cs @@ -56,10 +56,10 @@ public async Task concurrent_append_providers() await Task.WhenAll(tasks); - graph.StorageFor().ShouldBeTheSameAs(documentProvider1); - graph.StorageFor().ShouldBeTheSameAs(documentProvider2); - graph.StorageFor().ShouldBeTheSameAs(documentProvider3); - graph.StorageFor().ShouldBeTheSameAs(documentProvider4); + graph.StorageFor().ShouldBeSameAs(documentProvider1); + graph.StorageFor().ShouldBeSameAs(documentProvider2); + graph.StorageFor().ShouldBeSameAs(documentProvider3); + graph.StorageFor().ShouldBeSameAs(documentProvider4); } public class MockDocumentProvider: DocumentProvider where T : notnull diff --git a/src/CoreTests/CoreTests.csproj b/src/CoreTests/CoreTests.csproj index 018ad3b053..5f32668e62 100644 --- a/src/CoreTests/CoreTests.csproj +++ b/src/CoreTests/CoreTests.csproj @@ -114,6 +114,12 @@ Harness\TestsSettings.cs + + MartenHostEnvironment.cs + + + RecordingLogger.cs + SchemaMigrationExtensions.cs diff --git a/src/CoreTests/Diagnostics/ability_to_fetch_postgres_server_version.cs b/src/CoreTests/Diagnostics/ability_to_fetch_postgres_server_version.cs index 9d0c659209..126e9a194f 100644 --- a/src/CoreTests/Diagnostics/ability_to_fetch_postgres_server_version.cs +++ b/src/CoreTests/Diagnostics/ability_to_fetch_postgres_server_version.cs @@ -1,4 +1,5 @@ using Marten.Testing.Harness; +using Shouldly; using Xunit; namespace CoreTests.Diagnostics; @@ -17,4 +18,4 @@ public void can_fetch_postgres_server_version() public ability_to_fetch_postgres_server_version(DefaultStoreFixture fixture) : base(fixture) { } -} \ No newline at end of file +} diff --git a/src/CoreTests/Exceptions/known_exception_causes_dueto_pg10.cs b/src/CoreTests/Exceptions/known_exception_causes_dueto_pg10.cs index 4fa73062fe..f6b3a27242 100644 --- a/src/CoreTests/Exceptions/known_exception_causes_dueto_pg10.cs +++ b/src/CoreTests/Exceptions/known_exception_causes_dueto_pg10.cs @@ -20,7 +20,7 @@ public void can_map_web_style_search_not_supported() }); e.Reason.ShouldBe(NotSupportedReason.WebStyleSearchNeedsAtLeastPostgresVersion11); - SpecificationExtensions.ShouldContain(e.Message, KnownNotSupportedExceptionCause.WebStyleSearch.Description); + e.Message.ShouldContain(KnownNotSupportedExceptionCause.WebStyleSearch.Description); } public known_exception_causes_dueto_pg10(DefaultStoreFixture fixture) : base(fixture) diff --git a/src/CoreTests/Exceptions/known_exception_causes_dueto_pg9.cs b/src/CoreTests/Exceptions/known_exception_causes_dueto_pg9.cs index 0fe37fa4f3..a12457439f 100644 --- a/src/CoreTests/Exceptions/known_exception_causes_dueto_pg9.cs +++ b/src/CoreTests/Exceptions/known_exception_causes_dueto_pg9.cs @@ -20,7 +20,7 @@ public void can_map_jsonb_FTS_not_supported() }); e.Reason.ShouldBe(NotSupportedReason.FullTextSearchNeedsAtLeastPostgresVersion10); - SpecificationExtensions.ShouldContain(e.Message, KnownNotSupportedExceptionCause.ToTsvectorOnJsonb.Description); + e.Message.ShouldContain(KnownNotSupportedExceptionCause.ToTsvectorOnJsonb.Description); } [PgVersionTargetedFact(MaximumVersion = "10.0")] @@ -31,7 +31,8 @@ public void can_totsvector_other_than_jsonb_without_FTS_exception() using var session = theStore.QuerySession(); session.Query("to_tsvector(?)", 0).ToList(); }); - SpecificationExtensions.ShouldNotBeOfType(e); + + e.ShouldNotBeOfType(); } public known_exception_causes_dueto_pg9(DefaultStoreFixture fixture) : base(fixture) diff --git a/src/CoreTests/Internal/Generated/Stores/IFirstStoreImplementation1763841752.cs b/src/CoreTests/Internal/Generated/Stores/IFirstStoreImplementation1763841752.cs deleted file mode 100644 index f45bfdf18e..0000000000 --- a/src/CoreTests/Internal/Generated/Stores/IFirstStoreImplementation1763841752.cs +++ /dev/null @@ -1,24 +0,0 @@ -// -#pragma warning disable -using Marten; - -namespace Marten.Generated.Stores -{ - // START: IFirstStoreImplementation1763841752 - public class IFirstStoreImplementation1763841752 : Marten.DocumentStore, CoreTests.IFirstStore - { - private readonly Marten.StoreOptions _options; - - public IFirstStoreImplementation1763841752(Marten.StoreOptions options) : base(options) - { - _options = options; - } - - - } - - // END: IFirstStoreImplementation1763841752 - - -} - diff --git a/src/CoreTests/Internal/Sessions/EventTracingConnectionLifetimeTests.cs b/src/CoreTests/Internal/Sessions/EventTracingConnectionLifetimeTests.cs index 61ab220635..82cfbab30e 100644 --- a/src/CoreTests/Internal/Sessions/EventTracingConnectionLifetimeTests.cs +++ b/src/CoreTests/Internal/Sessions/EventTracingConnectionLifetimeTests.cs @@ -104,10 +104,10 @@ public void Execute_Ensure_The_Correct_Event_And_Tags_Are_Emited_When_Command_Ex _endCalled = true; activity.ShouldNotBeNull(); var expectedTag = activity.Tags.SingleOrDefault(); - expectedTag.ShouldNotBeNull(); + expectedTag.ShouldNotBe(default); expectedTag.Key.ShouldBe(MartenTracing.TenantId); var expectedEvent = activity.Events.SingleOrDefault(); - expectedEvent.ShouldNotBeNull(); + expectedEvent.ShouldNotBe(default); expectedEvent.Name.ShouldBe(MartenCommandExecutionStarted); expectedEvent.Tags.ShouldBeEmpty(); } @@ -146,7 +146,7 @@ public void Execute_Ensure_The_Correct_Events_And_Tags_Are_Emited_When_Command_E { _endCalled = true; var expectedTag = activity.Tags.SingleOrDefault(); - expectedTag.ShouldNotBeNull(); + expectedTag.ShouldNotBe(default); expectedTag.Key.ShouldBe(MartenTracing.TenantId); activity.Events.Count().ShouldBe(2); var firstEvent = activity.Events.First(); @@ -195,10 +195,10 @@ public async Task ExecuteAsync_Ensure_The_Correct_Event_And_Tags_Are_Emited_When _endCalled = true; activity.ShouldNotBeNull(); var expectedTag = activity.Tags.SingleOrDefault(); - expectedTag.ShouldNotBeNull(); + expectedTag.ShouldNotBe(default); expectedTag.Key.ShouldBe(MartenTracing.TenantId); var expectedEvent = activity.Events.SingleOrDefault(); - expectedEvent.ShouldNotBeNull(); + expectedEvent.ShouldNotBe(default); expectedEvent.Name.ShouldBe(MartenCommandExecutionStarted); expectedEvent.Tags.ShouldBeEmpty(); } @@ -238,7 +238,7 @@ public async Task ExecuteAsync_Ensure_The_Correct_Events_And_Tags_Are_Emited_Whe { _endCalled = true; var expectedTag = activity.Tags.SingleOrDefault(); - expectedTag.ShouldNotBeNull(); + expectedTag.ShouldNotBe(default); expectedTag.Key.ShouldBe(MartenTracing.TenantId); activity.Events.Count().ShouldBe(2); var firstEvent = activity.Events.First(); @@ -287,10 +287,10 @@ public void ExecuteReader_Ensure_The_Correct_Event_And_Tags_Are_Emited_When_Comm _endCalled = true; activity.ShouldNotBeNull(); var expectedTag = activity.Tags.SingleOrDefault(); - expectedTag.ShouldNotBeNull(); + expectedTag.ShouldNotBe(default); expectedTag.Key.ShouldBe(MartenTracing.TenantId); var expectedEvent = activity.Events.SingleOrDefault(); - expectedEvent.ShouldNotBeNull(); + expectedEvent.ShouldNotBe(default); expectedEvent.Name.ShouldBe(MartenCommandExecutionStarted); expectedEvent.Tags.ShouldBeEmpty(); } @@ -331,7 +331,6 @@ public void ExecuteReader_Ensure_The_Correct_Events_And_Tags_Are_Emited_When_Com { _endCalled = true; var expectedTag = activity.Tags.SingleOrDefault(); - expectedTag.ShouldNotBeNull(); expectedTag.Key.ShouldBe(MartenTracing.TenantId); activity.Events.Count().ShouldBe(2); var firstEvent = activity.Events.First(); @@ -381,10 +380,8 @@ public async Task ExecuteReaderAsync_Ensure_The_Correct_Event_And_Tags_Are_Emite _endCalled = true; activity.ShouldNotBeNull(); var expectedTag = activity.Tags.SingleOrDefault(); - expectedTag.ShouldNotBeNull(); expectedTag.Key.ShouldBe(MartenTracing.TenantId); var expectedEvent = activity.Events.SingleOrDefault(); - expectedEvent.ShouldNotBeNull(); expectedEvent.Name.ShouldBe(MartenCommandExecutionStarted); expectedEvent.Tags.ShouldBeEmpty(); } @@ -425,7 +422,6 @@ public async Task ExecuteReaderAsync_Ensure_The_Correct_Events_And_Tags_Are_Emit { _endCalled = true; var expectedTag = activity.Tags.SingleOrDefault(); - expectedTag.ShouldNotBeNull(); expectedTag.Key.ShouldBe(MartenTracing.TenantId); activity.Events.Count().ShouldBe(2); var firstEvent = activity.Events.First(); @@ -474,10 +470,8 @@ public void ExecuteReaderWithBatch_Ensure_The_Correct_Event_And_Tags_Are_Emited_ _endCalled = true; activity.ShouldNotBeNull(); var expectedTag = activity.Tags.SingleOrDefault(); - expectedTag.ShouldNotBeNull(); expectedTag.Key.ShouldBe(MartenTracing.TenantId); var expectedEvent = activity.Events.SingleOrDefault(); - expectedEvent.ShouldNotBeNull(); expectedEvent.Name.ShouldBe(MartenBatchExecutionStarted); expectedEvent.Tags.ShouldBeEmpty(); } @@ -518,7 +512,6 @@ public void ExecuteReaderWithBatch_Ensure_The_Correct_Events_And_Tags_Are_Emited { _endCalled = true; var expectedTag = activity.Tags.SingleOrDefault(); - expectedTag.ShouldNotBeNull(); expectedTag.Key.ShouldBe(MartenTracing.TenantId); activity.Events.Count().ShouldBe(2); var firstEvent = activity.Events.First(); @@ -567,10 +560,8 @@ public async Task ExecuteReaderWithBatchAsync_Ensure_The_Correct_Event_And_Tags_ _endCalled = true; activity.ShouldNotBeNull(); var expectedTag = activity.Tags.SingleOrDefault(); - expectedTag.ShouldNotBeNull(); expectedTag.Key.ShouldBe(MartenTracing.TenantId); var expectedEvent = activity.Events.SingleOrDefault(); - expectedEvent.ShouldNotBeNull(); expectedEvent.Name.ShouldBe(MartenBatchExecutionStarted); expectedEvent.Tags.ShouldBeEmpty(); } @@ -611,7 +602,6 @@ public async Task ExecuteReaderWithBatchAsync_Ensure_The_Correct_Events_And_Tags { _endCalled = true; var expectedTag = activity.Tags.SingleOrDefault(); - expectedTag.ShouldNotBeNull(); expectedTag.Key.ShouldBe(MartenTracing.TenantId); activity.Events.Count().ShouldBe(2); var firstEvent = activity.Events.First(); @@ -660,10 +650,8 @@ public void ExecuteBatchPages_Ensure_The_Correct_Event_And_Tags_Are_Emited_When_ _endCalled = true; activity.ShouldNotBeNull(); var expectedTag = activity.Tags.SingleOrDefault(); - expectedTag.ShouldNotBeNull(); expectedTag.Key.ShouldBe(MartenTracing.TenantId); var expectedEvent = activity.Events.SingleOrDefault(); - expectedEvent.ShouldNotBeNull(); expectedEvent.Name.ShouldBe(MartenBatchPagesExecutionStarted); expectedEvent.Tags.ShouldBeEmpty(); } @@ -703,10 +691,8 @@ public async Task ExecuteBatchPagesAsync_Ensure_The_Correct_Event_And_Tags_Are_E _endCalled = true; activity.ShouldNotBeNull(); var expectedTag = activity.Tags.SingleOrDefault(); - expectedTag.ShouldNotBeNull(); expectedTag.Key.ShouldBe(MartenTracing.TenantId); var expectedEvent = activity.Events.SingleOrDefault(); - expectedEvent.ShouldNotBeNull(); expectedEvent.Name.ShouldBe(MartenBatchPagesExecutionStarted); expectedEvent.Tags.ShouldBeEmpty(); } diff --git a/src/CoreTests/MartenServiceCollectionExtensionsTests.cs b/src/CoreTests/MartenServiceCollectionExtensionsTests.cs index 0e95c5f7e4..201d758dee 100644 --- a/src/CoreTests/MartenServiceCollectionExtensionsTests.cs +++ b/src/CoreTests/MartenServiceCollectionExtensionsTests.cs @@ -10,6 +10,7 @@ using Marten.Internal.Sessions; using Marten.Services; using Marten.Sessions; +using Marten.Testing; using Marten.Testing.Documents; using Marten.Testing.Harness; using Microsoft.Extensions.DependencyInjection; @@ -152,7 +153,12 @@ public async Task apply_changes_on_startup() // The normal Marten configuration services.AddMarten(opts => { + // This helps isolate a test, not something you need to do + // in normal usage + opts.ApplyChangesLockId += 18; + opts.Connection(ConnectionSource.ConnectionString); + opts.DatabaseSchemaName = "apply_changes"; opts.RegisterDocumentType(); }) @@ -186,6 +192,7 @@ public async Task assert_configuration_on_startup() { opts.Connection(ConnectionSource.ConnectionString); opts.RegisterDocumentType(); + opts.DatabaseSchemaName = "startup"; }) .AssertDatabaseMatchesConfigurationOnStartup(); }); @@ -486,6 +493,6 @@ private static void ShouldHaveAllTheExpectedRegistrations(Container container, container.GetInstance().ShouldNotBeNull(); container.GetInstance().ShouldNotBeNull(); - container.GetInstance().ShouldBeTheSameAs(store.As().Tenancy); + container.GetInstance().ShouldBeSameAs(store.As().Tenancy); } } diff --git a/src/CoreTests/SessionOptionsTests.cs b/src/CoreTests/SessionOptionsTests.cs index 0b1f9778c3..51ea673840 100644 --- a/src/CoreTests/SessionOptionsTests.cs +++ b/src/CoreTests/SessionOptionsTests.cs @@ -51,7 +51,7 @@ public void for_database() var database = Substitute.For(); var options = SessionOptions.ForDatabase(database); - options.Tenant?.Database.ShouldBeTheSameAs(database); + options.Tenant?.Database.ShouldBeSameAs(database); options.Tenant?.TenantId.ShouldBe(Tenancy.DefaultTenantId); options.OwnsConnection.ShouldBeTrue(); options.OwnsTransactionLifecycle.ShouldBeTrue(); diff --git a/src/CoreTests/Util/RecentlyUsedCacheTests.cs b/src/CoreTests/Util/RecentlyUsedCacheTests.cs index d22a2f7123..1111b81da6 100644 --- a/src/CoreTests/Util/RecentlyUsedCacheTests.cs +++ b/src/CoreTests/Util/RecentlyUsedCacheTests.cs @@ -25,7 +25,7 @@ public void get_the_same_value_back() foreach (var item in items) { theCache.TryFind(item.Id, out var found).ShouldBeTrue(); - found.ShouldBeTheSameAs(item); + found.ShouldBeSameAs(item); } } diff --git a/src/CoreTests/adding_custom_schema_objects.cs b/src/CoreTests/adding_custom_schema_objects.cs index bab1f95df6..6190d771d6 100644 --- a/src/CoreTests/adding_custom_schema_objects.cs +++ b/src/CoreTests/adding_custom_schema_objects.cs @@ -37,7 +37,7 @@ public void extension_feature_is_active_with_custom_extended_objects() var feature = theStore.Options.Storage.AllActiveFeatures(theStore.Storage.Database) .OfType().Single().As(); - feature.Objects.Single().ShouldBeTheSameAs(table); + feature.Objects.Single().ShouldBeSameAs(table); } [Fact] diff --git a/src/CoreTests/create_database_Tests.cs b/src/CoreTests/create_database_Tests.cs index 6a562f03db..aee350eee1 100644 --- a/src/CoreTests/create_database_Tests.cs +++ b/src/CoreTests/create_database_Tests.cs @@ -107,11 +107,11 @@ public async Task can_use_existing_database_without_calling_into_create() { var user1 = new User { FirstName = "User" }; var dbCreated = false; - using var store = DocumentStore.For(_ => + using var store = DocumentStore.For(opts => { - _.AutoCreateSchemaObjects = AutoCreate.All; - _.Connection(ConnectionSource.ConnectionString); - _.CreateDatabasesForTenants(c => + opts.AutoCreateSchemaObjects = AutoCreate.All; + opts.Connection(ConnectionSource.ConnectionString); + opts.CreateDatabasesForTenants(c => { c.MaintenanceDatabase(ConnectionSource.ConnectionString); c.ForTenant() diff --git a/src/CoreTests/request_count_tracking.cs b/src/CoreTests/request_count_tracking.cs index 0c3fecca30..58692993ca 100644 --- a/src/CoreTests/request_count_tracking.cs +++ b/src/CoreTests/request_count_tracking.cs @@ -1,9 +1,8 @@ using System; -using System.Collections.Generic; using System.Threading.Tasks; using Marten; using Marten.Exceptions; -using Marten.Services; +using Marten.Testing; using Marten.Testing.Harness; using Npgsql; using Shouldly; @@ -124,59 +123,3 @@ public async Task log_execute_success_2_async() logger.LastCommand.ShouldBeSameAs(cmd); } } - -public class RecordingLogger: IMartenSessionLogger -{ - public NpgsqlCommand LastCommand; - public Exception LastException; - public readonly IList Commits = new List(); - public IChangeSet LastCommit { get; set; } - - public IDocumentSession LastSession { get; set; } - - public int OnBeforeExecuted { get; set; } - - public void LogFailure(NpgsqlBatch batch, Exception ex) - { - - } - - public void LogFailure(Exception ex, string message) - { - - } - - public void RecordSavedChanges(IDocumentSession session, IChangeSet commit) - { - LastSession = session; - LastCommit = commit.Clone(); - - Commits.Add(commit); - } - - public void OnBeforeExecute(NpgsqlCommand command) - { - OnBeforeExecuted++; - } - - public void OnBeforeExecute(NpgsqlBatch batch) - { - - } - - public void LogSuccess(NpgsqlCommand command) - { - LastCommand = command; - } - - public void LogFailure(NpgsqlCommand command, Exception ex) - { - LastCommand = command; - LastException = ex; - } - - public void LogSuccess(NpgsqlBatch batch) - { - - } -} diff --git a/src/CoreTests/retry_mechanism.cs b/src/CoreTests/retry_mechanism.cs index 2fec10db27..94057769c2 100644 --- a/src/CoreTests/retry_mechanism.cs +++ b/src/CoreTests/retry_mechanism.cs @@ -14,15 +14,13 @@ namespace CoreTests; -public class retry_mechanism : IntegrationContext +public class retry_mechanism : OneOffConfigurationsContext { - public retry_mechanism(DefaultStoreFixture fixture) : base(fixture) - { - } - [Fact] public async Task can_successfully_retry() { + StoreOptions(opts => opts.DatabaseSchemaName = "retries"); + var sometimesFailingOperation1 = new SometimesFailingOperation(); theSession.QueueOperation(sometimesFailingOperation1); @@ -35,6 +33,8 @@ public async Task can_successfully_retry() [Fact] public async Task can_successfully_retry_sync() { + StoreOptions(opts => opts.DatabaseSchemaName = "retries"); + var sometimesFailingOperation1 = new SometimesFailingOperation(); theSession.QueueOperation(sometimesFailingOperation1); diff --git a/src/CoreTests/sticky_connection_mode.cs b/src/CoreTests/sticky_connection_mode.cs index ade9b2258d..f8b2db31dd 100644 --- a/src/CoreTests/sticky_connection_mode.cs +++ b/src/CoreTests/sticky_connection_mode.cs @@ -20,7 +20,7 @@ public async Task use_sticky_connection() var target = Target.Random(); theSession.Store(target); - theSession.Connection.ShouldBeTheSameAs(connection); + theSession.Connection.ShouldBeSameAs(connection); await theSession.SaveChangesAsync(); } diff --git a/src/DaemonTests/Bugs/Bug_2201_out_of_order_exception_with_hard_deletes.cs b/src/DaemonTests/Bugs/Bug_2201_out_of_order_exception_with_hard_deletes.cs index d4068d94f6..b0334c8033 100644 --- a/src/DaemonTests/Bugs/Bug_2201_out_of_order_exception_with_hard_deletes.cs +++ b/src/DaemonTests/Bugs/Bug_2201_out_of_order_exception_with_hard_deletes.cs @@ -7,6 +7,7 @@ using Marten.Events.Projections; using Marten.Storage; using Marten.Testing.Harness; +using Shouldly; using Xunit; namespace DaemonTests.Bugs; diff --git a/src/DaemonTests/Bugs/Bug_sequential_rebuilds_throws_internally.cs b/src/DaemonTests/Bugs/Bug_sequential_rebuilds_throws_internally.cs index 23c47de165..1e3ea0ed6c 100644 --- a/src/DaemonTests/Bugs/Bug_sequential_rebuilds_throws_internally.cs +++ b/src/DaemonTests/Bugs/Bug_sequential_rebuilds_throws_internally.cs @@ -5,6 +5,7 @@ using Marten.Events.Aggregation; using Marten.Events.Projections; using Marten.Testing.Harness; +using Shouldly; using Xunit; using Xunit.Abstractions; diff --git a/src/DaemonTests/MultiStreamAggregationTests.cs b/src/DaemonTests/MultiStreamAggregationTests.cs index a6284b363e..dfc8909fd4 100644 --- a/src/DaemonTests/MultiStreamAggregationTests.cs +++ b/src/DaemonTests/MultiStreamAggregationTests.cs @@ -6,6 +6,7 @@ using Marten.Events; using Marten.Events.Projections; using Marten.Testing.Harness; +using Shouldly; using Xunit; namespace DaemonTests; diff --git a/src/DaemonTests/ViewProjectionTests.cs b/src/DaemonTests/ViewProjectionTests.cs index 45a441d188..7b9a5c1484 100644 --- a/src/DaemonTests/ViewProjectionTests.cs +++ b/src/DaemonTests/ViewProjectionTests.cs @@ -54,7 +54,7 @@ public async Task splicing_events() for (var i = 0; i < travel.Data.Stops.Count; i++) { - events.ElementAt(index + i + 1).Data.ShouldBeTheSameAs(travel.Data.Stops[i]); + events.ElementAt(index + i + 1).Data.ShouldBeSameAs(travel.Data.Stops[i]); } } } diff --git a/src/DaemonTests/multistream_data_teardown_on_rebuild.cs b/src/DaemonTests/multistream_data_teardown_on_rebuild.cs index 983d3866c3..ef81b3a734 100644 --- a/src/DaemonTests/multistream_data_teardown_on_rebuild.cs +++ b/src/DaemonTests/multistream_data_teardown_on_rebuild.cs @@ -3,6 +3,7 @@ using System.Threading.Tasks; using Marten.Events.Projections; using Marten.Testing.Harness; +using Shouldly; using Xunit; namespace DaemonTests; diff --git a/src/DaemonTests/pausing_and_resuming_the_daemon.cs b/src/DaemonTests/pausing_and_resuming_the_daemon.cs index a038e01742..9b54645437 100644 --- a/src/DaemonTests/pausing_and_resuming_the_daemon.cs +++ b/src/DaemonTests/pausing_and_resuming_the_daemon.cs @@ -8,6 +8,7 @@ using Marten.Events.Projections; using Marten.Testing.Harness; using Microsoft.Extensions.Hosting; +using Shouldly; using Xunit; using Xunit.Abstractions; diff --git a/src/DaemonTests/projection_progression_operations.cs b/src/DaemonTests/projection_progression_operations.cs index aa3bda7449..74d9f07041 100644 --- a/src/DaemonTests/projection_progression_operations.cs +++ b/src/DaemonTests/projection_progression_operations.cs @@ -104,7 +104,7 @@ public async Task update_sad_path() await theSession.SaveChangesAsync(); }); - ex.Message.ShouldContain("four", StringComparisonOption.Default); + ex.Message.ShouldContain("four"); // Just verifying that the real progress didn't change var progress = await theStore.Advanced.ProjectionProgressFor(new ShardName("four")); @@ -139,4 +139,4 @@ public async Task fetch_progress_does_not_exist_returns_0() } -} \ No newline at end of file +} diff --git a/src/DocumentDbTests/Bugs/Bug_1002_new_duplicate_field_write_patch_syntax_error.cs b/src/DocumentDbTests/Bugs/Bug_1002_new_duplicate_field_write_patch_syntax_error.cs index 11eb03c24d..55cfe7c275 100644 --- a/src/DocumentDbTests/Bugs/Bug_1002_new_duplicate_field_write_patch_syntax_error.cs +++ b/src/DocumentDbTests/Bugs/Bug_1002_new_duplicate_field_write_patch_syntax_error.cs @@ -1,6 +1,7 @@ using System.Threading.Tasks; using Marten.Testing; using Marten.Testing.Harness; +using Shouldly; using Weasel.Core; using Weasel.Postgresql; using Xunit; @@ -37,4 +38,4 @@ public class Bug_1002 { public string Id { get; set; } public string Name { get; set; } -} \ No newline at end of file +} diff --git a/src/DocumentDbTests/Bugs/Bug_1416_foreign_key_with_document_alias.cs b/src/DocumentDbTests/Bugs/Bug_1416_foreign_key_with_document_alias.cs index 2657dea3d4..becd83fb80 100644 --- a/src/DocumentDbTests/Bugs/Bug_1416_foreign_key_with_document_alias.cs +++ b/src/DocumentDbTests/Bugs/Bug_1416_foreign_key_with_document_alias.cs @@ -1,6 +1,7 @@ using System; using System.Threading.Tasks; using Marten.Testing.Harness; +using Shouldly; using Xunit; using Xunit.Abstractions; @@ -46,4 +47,4 @@ public class OriginalNameEntity public class RelatedEntity { public Guid Id { get; set; } -} \ No newline at end of file +} diff --git a/src/DocumentDbTests/Bugs/Bug_1454_comparison_between_data_offset_in_child_collection.cs b/src/DocumentDbTests/Bugs/Bug_1454_comparison_between_data_offset_in_child_collection.cs index 563ee1722d..aa2ddbe103 100644 --- a/src/DocumentDbTests/Bugs/Bug_1454_comparison_between_data_offset_in_child_collection.cs +++ b/src/DocumentDbTests/Bugs/Bug_1454_comparison_between_data_offset_in_child_collection.cs @@ -2,6 +2,7 @@ using System.Linq; using Marten.Testing.Documents; using Marten.Testing.Harness; +using Shouldly; using Xunit; namespace DocumentDbTests.Bugs; @@ -27,4 +28,4 @@ public void can_query_against_DateTimeOffset() .Where(x => x.DateOffset == DateTimeOffset.UtcNow) .ToList().ShouldNotBeNull(); } -} \ No newline at end of file +} diff --git a/src/DocumentDbTests/Bugs/Bug_1647_cannot_use_Task_as_document_name.cs b/src/DocumentDbTests/Bugs/Bug_1647_cannot_use_Task_as_document_name.cs index 0a8863e311..e4bd0a739d 100644 --- a/src/DocumentDbTests/Bugs/Bug_1647_cannot_use_Task_as_document_name.cs +++ b/src/DocumentDbTests/Bugs/Bug_1647_cannot_use_Task_as_document_name.cs @@ -1,6 +1,7 @@ using System; using Marten.Testing.Harness; using Marten.Testing.Weird; +using Shouldly; using Xunit; namespace DocumentDbTests.Bugs diff --git a/src/DocumentDbTests/Bugs/Bug_1994_insert_update_on_same_object_in_transaction.cs b/src/DocumentDbTests/Bugs/Bug_1994_insert_update_on_same_object_in_transaction.cs index a21123d6a7..f2e7ef1e64 100644 --- a/src/DocumentDbTests/Bugs/Bug_1994_insert_update_on_same_object_in_transaction.cs +++ b/src/DocumentDbTests/Bugs/Bug_1994_insert_update_on_same_object_in_transaction.cs @@ -32,7 +32,7 @@ public async Task bug_1994_pending_changes_after_insert_and_store_on_same_object session1.PendingChanges.InsertsFor() - .Single().ShouldBeTheSameAs(user1); + .Single().ShouldBeSameAs(user1); session1.PendingChanges.AllChangedFor() .Contains(user1).ShouldBeTrue(); @@ -46,4 +46,4 @@ await Should.ThrowAsync(async () => } -} \ No newline at end of file +} diff --git a/src/DocumentDbTests/Bugs/Bug_393_issue_with_identity_map.cs b/src/DocumentDbTests/Bugs/Bug_393_issue_with_identity_map.cs index c701b6d21f..10586e0a50 100644 --- a/src/DocumentDbTests/Bugs/Bug_393_issue_with_identity_map.cs +++ b/src/DocumentDbTests/Bugs/Bug_393_issue_with_identity_map.cs @@ -2,6 +2,7 @@ using Marten.Schema.Identity; using Marten.Testing.Harness; using Xunit; +using Shouldly; namespace DocumentDbTests.Bugs; @@ -21,7 +22,7 @@ public void load_non_existing_with_a_store_should_return_new_added_document() details = session.Load(routeId); // this was always null - details.ShouldBeTheSameAs(routeDetails); + details.ShouldBeSameAs(routeDetails); } public Bug_393_issue_with_identity_map(DefaultStoreFixture fixture): base(fixture) @@ -45,7 +46,7 @@ public void load_non_existing_with_a_store_should_return_new_added_document() details = session.Load(routeId); - details.ShouldBeTheSameAs(routeDetails); + details.ShouldBeSameAs(routeDetails); } public Bug_393_issue_with_dirty_tracking_identity_map(DefaultStoreFixture fixture): base(fixture) diff --git a/src/DocumentDbTests/Bugs/Bug_654_document_session_delete_Tests.cs b/src/DocumentDbTests/Bugs/Bug_654_document_session_delete_Tests.cs index f6ba6c83b1..bd4152ee35 100644 --- a/src/DocumentDbTests/Bugs/Bug_654_document_session_delete_Tests.cs +++ b/src/DocumentDbTests/Bugs/Bug_654_document_session_delete_Tests.cs @@ -3,6 +3,7 @@ using Marten.Services; using Marten.Testing.Documents; using Marten.Testing.Harness; +using Shouldly; using Xunit; namespace DocumentDbTests.Bugs; diff --git a/src/DocumentDbTests/Bugs/Bug_837_missing_func_mt_immutable_timestamp_when_initializing_with_new_Schema.cs b/src/DocumentDbTests/Bugs/Bug_837_missing_func_mt_immutable_timestamp_when_initializing_with_new_Schema.cs index f203f528b9..e03ee32835 100644 --- a/src/DocumentDbTests/Bugs/Bug_837_missing_func_mt_immutable_timestamp_when_initializing_with_new_Schema.cs +++ b/src/DocumentDbTests/Bugs/Bug_837_missing_func_mt_immutable_timestamp_when_initializing_with_new_Schema.cs @@ -2,6 +2,7 @@ using System.Linq; using Marten.Testing.Documents; using Marten.Testing.Harness; +using Shouldly; using Weasel.Core; using Weasel.Postgresql; using Xunit; diff --git a/src/DocumentDbTests/Bugs/ability_to_persist_nested_types_Tests.cs b/src/DocumentDbTests/Bugs/ability_to_persist_nested_types_Tests.cs index e585e5d230..cae820314e 100644 --- a/src/DocumentDbTests/Bugs/ability_to_persist_nested_types_Tests.cs +++ b/src/DocumentDbTests/Bugs/ability_to_persist_nested_types_Tests.cs @@ -2,6 +2,7 @@ using System.Threading.Tasks; using Marten.Services; using Marten.Testing.Harness; +using Shouldly; using Xunit; namespace DocumentDbTests.Bugs; diff --git a/src/DocumentDbTests/Concurrency/optimistic_concurrency.cs b/src/DocumentDbTests/Concurrency/optimistic_concurrency.cs index 3fd09f73ac..0e7b438f22 100644 --- a/src/DocumentDbTests/Concurrency/optimistic_concurrency.cs +++ b/src/DocumentDbTests/Concurrency/optimistic_concurrency.cs @@ -49,7 +49,7 @@ public async Task can_insert_with_optimistic_concurrency_95() session.Store(coffeeShop); await session.SaveChangesAsync(); - SpecificationExtensions.ShouldNotBeNull(session.Load(coffeeShop.Id)); + session.Load(coffeeShop.Id).ShouldNotBeNull(); } [Fact] @@ -60,7 +60,7 @@ public async Task can_insert_with_optimistic_concurrency_95_async() session.Store(coffeeShop); await session.SaveChangesAsync(); - SpecificationExtensions.ShouldNotBeNull((await session.LoadAsync(coffeeShop.Id))); + (await session.LoadAsync(coffeeShop.Id)).ShouldNotBeNull(); } [Fact] diff --git a/src/DocumentDbTests/Deleting/delete_a_single_document.cs b/src/DocumentDbTests/Deleting/delete_a_single_document.cs index 9990bbd768..2e7f0fa9d2 100644 --- a/src/DocumentDbTests/Deleting/delete_a_single_document.cs +++ b/src/DocumentDbTests/Deleting/delete_a_single_document.cs @@ -3,6 +3,7 @@ using Marten; using Marten.Testing.Documents; using Marten.Testing.Harness; +using Shouldly; using Xunit; namespace DocumentDbTests.Deleting; diff --git a/src/DocumentDbTests/ForeignKeys/configuring_foreign_key_fields.cs b/src/DocumentDbTests/ForeignKeys/configuring_foreign_key_fields.cs index ab5f1848ec..daf1de1b9d 100644 --- a/src/DocumentDbTests/ForeignKeys/configuring_foreign_key_fields.cs +++ b/src/DocumentDbTests/ForeignKeys/configuring_foreign_key_fields.cs @@ -4,6 +4,7 @@ using Marten; using Marten.Schema; using Marten.Testing.Harness; +using Shouldly; using Xunit; namespace DocumentDbTests.ForeignKeys; diff --git a/src/DocumentDbTests/ForeignKeys/foreign_keys.cs b/src/DocumentDbTests/ForeignKeys/foreign_keys.cs index 220d765da9..40ebc40f5d 100644 --- a/src/DocumentDbTests/ForeignKeys/foreign_keys.cs +++ b/src/DocumentDbTests/ForeignKeys/foreign_keys.cs @@ -146,8 +146,8 @@ public async Task can_delete_document_with_foreign_key() using (var query = theStore.QuerySession()) { - SpecificationExtensions.ShouldBeNull(query.Load(issue.Id)); - SpecificationExtensions.ShouldNotBeNull(query.Load(user.Id)); + query.Load(issue.Id).ShouldBeNull(); + query.Load(user.Id).ShouldNotBeNull(); } } @@ -174,8 +174,8 @@ public async Task can_delete_document_that_is_referenced_by_foreignkey_with_casc using (var query = theStore.QuerySession()) { - SpecificationExtensions.ShouldBeNull(query.Load(issue.Id)); - SpecificationExtensions.ShouldBeNull(query.Load(user.Id)); + query.Load(issue.Id).ShouldBeNull(); + query.Load(user.Id).ShouldBeNull(); } } @@ -205,8 +205,8 @@ public async Task cannot_delete_document_that_is_referenced_by_foreignkey_withou using (var query = theStore.QuerySession()) { - SpecificationExtensions.ShouldNotBeNull(query.Load(issue.Id)); - SpecificationExtensions.ShouldNotBeNull(query.Load(user.Id)); + query.Load(issue.Id).ShouldNotBeNull(); + query.Load(user.Id).ShouldNotBeNull(); } } @@ -228,9 +228,7 @@ private async Task ShouldProperlySave(Issue issue) using (var query = theStore.QuerySession()) { - var documentFromDb = query.Load(issue.Id); - - SpecificationExtensions.ShouldNotBeNull(documentFromDb); + query.Load(issue.Id).ShouldNotBeNull(); } } diff --git a/src/DocumentDbTests/HierarchicalStorage/persist_and_load_for_hierarchy_Tests.cs b/src/DocumentDbTests/HierarchicalStorage/persist_and_load_for_hierarchy_Tests.cs index 9a7f061b97..c69fc47b9c 100644 --- a/src/DocumentDbTests/HierarchicalStorage/persist_and_load_for_hierarchy_Tests.cs +++ b/src/DocumentDbTests/HierarchicalStorage/persist_and_load_for_hierarchy_Tests.cs @@ -74,12 +74,12 @@ public async Task persist_and_load_subclass() session.Store(admin1); await session.SaveChangesAsync(); - session.Load(admin1.Id).ShouldBeTheSameAs(admin1); - session.Load(admin1.Id).ShouldBeTheSameAs(admin1); + session.Load(admin1.Id).ShouldBeSameAs(admin1); + session.Load(admin1.Id).ShouldBeSameAs(admin1); using var query = theStore.QuerySession(); - query.Load(admin1.Id).ShouldNotBeTheSameAs(admin1).ShouldNotBeNull(); - query.Load(admin1.Id).ShouldNotBeTheSameAs(admin1).ShouldNotBeNull(); + query.Load(admin1.Id).ShouldNotBeNull().ShouldNotBeSameAs(admin1); + query.Load(admin1.Id).ShouldNotBeNull().ShouldNotBeSameAs(admin1); } [Fact] @@ -89,14 +89,13 @@ public async Task persist_and_load_subclass_async() session.Store(admin1); await session.SaveChangesAsync(); - (await session.LoadAsync(admin1.Id)).ShouldBeTheSameAs(admin1); - (await session.LoadAsync(admin1.Id)).ShouldBeTheSameAs(admin1); + (await session.LoadAsync(admin1.Id)).ShouldBeSameAs(admin1); + (await session.LoadAsync(admin1.Id)).ShouldBeSameAs(admin1); await using var query = theStore.QuerySession(); - (await query.LoadAsync(admin1.Id)).ShouldNotBeTheSameAs(admin1) - .ShouldNotBeNull(); - (await query.LoadAsync(admin1.Id)).ShouldNotBeTheSameAs(admin1) - .ShouldNotBeNull(); + (await query.LoadAsync(admin1.Id)).ShouldNotBeNull().ShouldNotBeSameAs(admin1) + ; + (await query.LoadAsync(admin1.Id)).ShouldNotBeNull().ShouldNotBeSameAs(admin1); } [Fact] @@ -106,9 +105,9 @@ public async Task persist_and_load_top_level() session.Store(user1); await session.SaveChangesAsync(); - session.Load(user1.Id).ShouldBeTheSameAs(user1); + session.Load(user1.Id).ShouldBeSameAs(user1); using var query = theStore.QuerySession(); - query.Load(user1.Id).ShouldNotBeTheSameAs(user1).ShouldNotBeNull(); + query.Load(user1.Id).ShouldNotBeNull().ShouldNotBeSameAs(user1); } } diff --git a/src/DocumentDbTests/HierarchicalStorage/query_through_mixed_population_Tests.cs b/src/DocumentDbTests/HierarchicalStorage/query_through_mixed_population_Tests.cs index 5d7c647877..886c628c9a 100644 --- a/src/DocumentDbTests/HierarchicalStorage/query_through_mixed_population_Tests.cs +++ b/src/DocumentDbTests/HierarchicalStorage/query_through_mixed_population_Tests.cs @@ -38,9 +38,9 @@ public async Task identity_map_usage_from_select() { using var session = await identitySessionWithData(); var users = session.Query().OrderBy(x => x.FirstName).ToArray(); - users[0].ShouldBeTheSameAs(admin1); - users[1].ShouldBeTheSameAs(super1); - users[5].ShouldBeTheSameAs(user2); + users[0].ShouldBeSameAs(admin1); + users[1].ShouldBeSameAs(super1); + users[5].ShouldBeSameAs(user2); } [Fact] diff --git a/src/DocumentDbTests/Indexes/duplicated_field.cs b/src/DocumentDbTests/Indexes/duplicated_field.cs index 4ebe4561a8..4205a53ac0 100644 --- a/src/DocumentDbTests/Indexes/duplicated_field.cs +++ b/src/DocumentDbTests/Indexes/duplicated_field.cs @@ -51,7 +51,7 @@ public async Task can_insert_document_with_duplicated_field_with_DuplicatedField { var documentFromDb = query.Load(document.Id); - SpecificationExtensions.ShouldNotBeNull(documentFromDb); + documentFromDb.ShouldNotBeNull(); documentFromDb.Color.ShouldBe(document.Color); } } @@ -84,7 +84,7 @@ public async Task can_insert_document_with_duplicated_field_with_not_null_constr { var documentFromDb = query.Load(document.Id); - SpecificationExtensions.ShouldNotBeNull(documentFromDb); + documentFromDb.ShouldNotBeNull(); documentFromDb.NonNullableDuplicateField.ShouldBe(document.NonNullableDuplicateField); documentFromDb.NonNullableDuplicateFieldViaAttribute.ShouldBe(document.NonNullableDuplicateFieldViaAttribute); } @@ -117,10 +117,10 @@ public async Task can_insert_document_with_duplicated_field_with_null_constraint { var documentFromDb = query.Load(document.Id); - SpecificationExtensions.ShouldNotBeNull(documentFromDb); - SpecificationExtensions.ShouldBeNull(documentFromDb.NullableDuplicateField); - SpecificationExtensions.ShouldBeNull(documentFromDb.NullableDateTimeDuplicateFieldViaAttribute); - SpecificationExtensions.ShouldBeNull(documentFromDb.NullableIntDuplicateFieldViaAttribute); + documentFromDb.ShouldNotBeNull(); + documentFromDb.NullableDuplicateField.ShouldBeNull(); + documentFromDb.NullableDateTimeDuplicateFieldViaAttribute.ShouldBeNull(); + documentFromDb.NullableIntDuplicateFieldViaAttribute.ShouldBeNull(); } } diff --git a/src/DocumentDbTests/Indexes/full_text_index.cs b/src/DocumentDbTests/Indexes/full_text_index.cs index 40747463e5..c102a93c17 100644 --- a/src/DocumentDbTests/Indexes/full_text_index.cs +++ b/src/DocumentDbTests/Indexes/full_text_index.cs @@ -525,7 +525,7 @@ public async Task creating_a_full_text_index_should_create_the_index_on_the_tabl var index = table.IndexFor("mt_doc_target_idx_fts"); index.ShouldNotBeNull(); - index.ToDDL(table).ShouldContain("to_tsvector", StringComparisonOption.Default); + index.ToDDL(table).ShouldContain("to_tsvector"); } [PgVersionTargetedFact(MinimumVersion = "10.0")] @@ -942,18 +942,18 @@ public static void ShouldContainIndexDefinitionFor( ddl.ShouldNotBeNull(); - SpecificationExtensions.ShouldContain(ddl, $"CREATE INDEX {indexName}"); - SpecificationExtensions.ShouldContain(ddl, $"ON {tableName}"); - SpecificationExtensions.ShouldContain(ddl, $"to_tsvector('{regConfig}',{dataConfig})"); + ddl.ShouldContain($"CREATE INDEX {indexName}"); + ddl.ShouldContain($"ON {tableName}"); + ddl.ShouldContain($"to_tsvector('{regConfig}',{dataConfig})"); if (regConfig != null) { - SpecificationExtensions.ShouldContain(ddl, regConfig); + ddl.ShouldContain(regConfig); } if (dataConfig != null) { - SpecificationExtensions.ShouldContain(ddl, dataConfig); + ddl.ShouldContain(dataConfig); } } } diff --git a/src/DocumentDbTests/Metadata/assigning_versions_to_documents.cs b/src/DocumentDbTests/Metadata/assigning_versions_to_documents.cs index 89902399e4..577db8497e 100644 --- a/src/DocumentDbTests/Metadata/assigning_versions_to_documents.cs +++ b/src/DocumentDbTests/Metadata/assigning_versions_to_documents.cs @@ -13,7 +13,7 @@ public class assigning_versions_to_documents : OneOffConfigurationsContext [Fact] public void no_version_member_by_default() { - SpecificationExtensions.ShouldBeNull(DocumentMapping.For().Metadata.Version.Member); + DocumentMapping.For().Metadata.Version.Member.ShouldBeNull(); } [Fact] diff --git a/src/DocumentDbTests/Metadata/fetching_entity_metadata.cs b/src/DocumentDbTests/Metadata/fetching_entity_metadata.cs index f795735398..01801f1e1e 100644 --- a/src/DocumentDbTests/Metadata/fetching_entity_metadata.cs +++ b/src/DocumentDbTests/Metadata/fetching_entity_metadata.cs @@ -138,7 +138,7 @@ public async Task created_timestamp_metadata_returns_timestamp() var metadata = session.MetadataFor(shop); metadata.ShouldNotBeNull(); - metadata.CreatedAt.ShouldNotBeNull(); + metadata.CreatedAt.ShouldNotBe(default); } } @@ -161,6 +161,6 @@ public async Task created_timestamp_metadata_returns_timestamp_async() await using var query = theStore.QuerySession(); var metadata = await query.MetadataForAsync(shop); - metadata.CreatedAt.ShouldNotBeNull(); + metadata.CreatedAt.ShouldNotBe(default); } } diff --git a/src/DocumentDbTests/MultiTenancy/conjoined_multi_tenancy.cs b/src/DocumentDbTests/MultiTenancy/conjoined_multi_tenancy.cs index bb4202e72a..d70dc83f8d 100644 --- a/src/DocumentDbTests/MultiTenancy/conjoined_multi_tenancy.cs +++ b/src/DocumentDbTests/MultiTenancy/conjoined_multi_tenancy.cs @@ -107,14 +107,14 @@ public async Task cannot_load_by_id_across_tenants_async() { await using (var red = theStore.QuerySession("Red")) { - SpecificationExtensions.ShouldNotBeNull(await red.LoadAsync(targetRed1.Id)); - SpecificationExtensions.ShouldBeNull(await red.LoadAsync(targetBlue1.Id)); + (await red.LoadAsync(targetRed1.Id)).ShouldNotBeNull(); + (await red.LoadAsync(targetBlue1.Id)).ShouldBeNull(); } await using (var blue = theStore.QuerySession("Blue")) { - SpecificationExtensions.ShouldNotBeNull(await blue.LoadAsync(targetBlue1.Id)); - SpecificationExtensions.ShouldBeNull(await blue.LoadAsync(targetRed1.Id)); + (await blue.LoadAsync(targetBlue1.Id)).ShouldNotBeNull(); + (await blue.LoadAsync(targetRed1.Id)).ShouldBeNull(); } } @@ -239,8 +239,8 @@ public async Task query_with_batch() await batch.Execute(); - SpecificationExtensions.ShouldNotBeNull(await foundRed); - SpecificationExtensions.ShouldBeNull(await notFoundGreen); + (await foundRed).ShouldNotBeNull(); + (await notFoundGreen).ShouldBeNull(); var found = await queryForReds; diff --git a/src/DocumentDbTests/MultiTenancy/conjoined_multi_tenancy_with_partitioning.cs b/src/DocumentDbTests/MultiTenancy/conjoined_multi_tenancy_with_partitioning.cs index ba0f97a6ab..67f2b05511 100644 --- a/src/DocumentDbTests/MultiTenancy/conjoined_multi_tenancy_with_partitioning.cs +++ b/src/DocumentDbTests/MultiTenancy/conjoined_multi_tenancy_with_partitioning.cs @@ -124,14 +124,14 @@ public async Task cannot_load_by_id_across_tenants_async() { await using (var red = theStore.QuerySession("Red")) { - SpecificationExtensions.ShouldNotBeNull(await red.LoadAsync(targetRed1.Id)); - SpecificationExtensions.ShouldBeNull(await red.LoadAsync(targetBlue1.Id)); + (await red.LoadAsync(targetRed1.Id)).ShouldNotBeNull(); + (await red.LoadAsync(targetBlue1.Id)).ShouldBeNull(); } await using (var blue = theStore.QuerySession("Blue")) { - SpecificationExtensions.ShouldNotBeNull(await blue.LoadAsync(targetBlue1.Id)); - SpecificationExtensions.ShouldBeNull(await blue.LoadAsync(targetRed1.Id)); + (await blue.LoadAsync(targetBlue1.Id)).ShouldNotBeNull(); + (await blue.LoadAsync(targetRed1.Id)).ShouldBeNull(); } } @@ -256,8 +256,8 @@ public async Task query_with_batch() await batch.Execute(); - SpecificationExtensions.ShouldNotBeNull(await foundRed); - SpecificationExtensions.ShouldBeNull(await notFoundGreen); + (await foundRed).ShouldNotBeNull(); + (await notFoundGreen).ShouldBeNull(); var found = await queryForReds; diff --git a/src/DocumentDbTests/Reading/BatchedQuerying/batched_querying_acceptance_Tests.cs b/src/DocumentDbTests/Reading/BatchedQuerying/batched_querying_acceptance_Tests.cs index c566e9d70f..e6e3870fb2 100644 --- a/src/DocumentDbTests/Reading/BatchedQuerying/batched_querying_acceptance_Tests.cs +++ b/src/DocumentDbTests/Reading/BatchedQuerying/batched_querying_acceptance_Tests.cs @@ -222,7 +222,7 @@ public async Task can_find_the_first_or_default_value() (await firstUser).UserName.ShouldBe("A2"); (await firstAdmin).UserName.ShouldBe("A3"); - SpecificationExtensions.ShouldBeNull((await noneUser)); + (await noneUser).ShouldBeNull(); } [Fact] @@ -240,7 +240,7 @@ public async Task single_and_single_or_default() (await tamba).FirstName.ShouldBe("Tamba"); (await justin).FirstName.ShouldBe("Justin"); - SpecificationExtensions.ShouldBeNull((await noneUser)); + (await noneUser).ShouldBeNull(); } @@ -353,8 +353,8 @@ public async Task can_find_one_doc_at_a_time_that_is_not_in_identity_map() await batch.Execute(); - SpecificationExtensions.ShouldNotBeNull((await task1).ShouldBeOfType()); - SpecificationExtensions.ShouldNotBeNull((await task3).ShouldBeOfType()); + (await task1).ShouldBeOfType(); + (await task3).ShouldBeOfType(); } [Fact] @@ -468,9 +468,9 @@ public async Task can_use_select_transformations_to_single_field_in_batch() (await toList).ShouldHaveTheSameElementsAs("Derrick", "Dontari", "Eric", "Justin", "Sean", "Tamba"); (await first).ShouldBe("Derrick"); - SpecificationExtensions.ShouldBeNull((await firstOrDefault)); + (await firstOrDefault).ShouldBeNull(); (await single).ShouldBe("Tamba"); - SpecificationExtensions.ShouldBeNull((await singleOrDefault)); + (await singleOrDefault).ShouldBeNull(); } [Fact] @@ -500,9 +500,9 @@ public async Task can_use_select_transformations_to_anonymous_type_in_batch() (await toList).Select(x => x.Name) .ShouldHaveTheSameElementsAs("Derrick", "Dontari", "Eric", "Justin", "Sean", "Tamba"); (await first).Name.ShouldBe("Derrick"); - SpecificationExtensions.ShouldBeNull((await firstOrDefault)); + (await firstOrDefault).ShouldBeNull(); (await single).Name.ShouldBe("Tamba"); - SpecificationExtensions.ShouldBeNull((await singleOrDefault)); + (await singleOrDefault).ShouldBeNull(); } @@ -538,9 +538,9 @@ public async Task can_use_select_transformations_to_another_type_in_batch() (await toList).Select(x => x.Name) .ShouldHaveTheSameElementsAs("Derrick", "Dontari", "Eric", "Justin", "Sean", "Tamba"); (await first).Name.ShouldBe("Derrick"); - SpecificationExtensions.ShouldBeNull((await firstOrDefault)); + (await firstOrDefault).ShouldBeNull(); (await single).Name.ShouldBe("Tamba"); - SpecificationExtensions.ShouldBeNull((await singleOrDefault)); + (await singleOrDefault).ShouldBeNull(); } diff --git a/src/DocumentDbTests/Reading/query_by_sql.cs b/src/DocumentDbTests/Reading/query_by_sql.cs index b4f0333567..c0a6547cf8 100644 --- a/src/DocumentDbTests/Reading/query_by_sql.cs +++ b/src/DocumentDbTests/Reading/query_by_sql.cs @@ -169,7 +169,7 @@ public async Task query_by_two_named_parameters() new { FirstName = "Jeremy", LastName = "Miller" }) .Single(); - SpecificationExtensions.ShouldNotBeNull(user); + user.ShouldNotBeNull(); } #endregion diff --git a/src/DocumentDbTests/Reading/query_plans.cs b/src/DocumentDbTests/Reading/query_plans.cs index 45e1711d0d..a0eb835451 100644 --- a/src/DocumentDbTests/Reading/query_plans.cs +++ b/src/DocumentDbTests/Reading/query_plans.cs @@ -12,12 +12,8 @@ namespace DocumentDbTests.Reading; -public class query_plans : IntegrationContext +public class query_plans : OneOffConfigurationsContext { - public query_plans(DefaultStoreFixture fixture) : base(fixture) - { - } - [Fact] public async Task query_by_query_plan() { diff --git a/src/DocumentDbTests/SessionMechanics/Using_Global_DocumentSessionListener_Tests.cs b/src/DocumentDbTests/SessionMechanics/Using_Global_DocumentSessionListener_Tests.cs index cf92d34bf1..45a1540817 100644 --- a/src/DocumentDbTests/SessionMechanics/Using_Global_DocumentSessionListener_Tests.cs +++ b/src/DocumentDbTests/SessionMechanics/Using_Global_DocumentSessionListener_Tests.cs @@ -40,11 +40,11 @@ public async Task call_listener_events_on_synchronous_session_saves() await session.SaveChangesAsync(); - stub1.SaveChangesSession.ShouldBeTheSameAs(session); - stub1.AfterCommitSession.ShouldBeTheSameAs(session); + stub1.SaveChangesSession.ShouldBeSameAs(session); + stub1.AfterCommitSession.ShouldBeSameAs(session); - stub2.SaveChangesSession.ShouldBeTheSameAs(session); - stub2.AfterCommitSession.ShouldBeTheSameAs(session); + stub2.SaveChangesSession.ShouldBeSameAs(session); + stub2.AfterCommitSession.ShouldBeSameAs(session); } } } @@ -72,11 +72,11 @@ public async Task call_listener_events_on_synchronous_session_saves_async() await session.SaveChangesAsync(); - stub1.SaveChangesSession.ShouldBeTheSameAs(session); - stub1.AfterCommitSession.ShouldBeTheSameAs(session); + stub1.SaveChangesSession.ShouldBeSameAs(session); + stub1.AfterCommitSession.ShouldBeSameAs(session); - stub2.SaveChangesSession.ShouldBeTheSameAs(session); - stub2.AfterCommitSession.ShouldBeTheSameAs(session); + stub2.SaveChangesSession.ShouldBeSameAs(session); + stub2.AfterCommitSession.ShouldBeSameAs(session); } } } diff --git a/src/DocumentDbTests/SessionMechanics/Using_Local_DocumentSessionListener_Tests.cs b/src/DocumentDbTests/SessionMechanics/Using_Local_DocumentSessionListener_Tests.cs index 8bbfd0000c..3e09bbae31 100644 --- a/src/DocumentDbTests/SessionMechanics/Using_Local_DocumentSessionListener_Tests.cs +++ b/src/DocumentDbTests/SessionMechanics/Using_Local_DocumentSessionListener_Tests.cs @@ -38,11 +38,11 @@ public async Task call_listener_events_on_synchronous_session_saves() await session.SaveChangesAsync(); - stub1.SaveChangesSession.ShouldBeTheSameAs(session); - stub1.AfterCommitSession.ShouldBeTheSameAs(session); + stub1.SaveChangesSession.ShouldBeSameAs(session); + stub1.AfterCommitSession.ShouldBeSameAs(session); - stub2.SaveChangesSession.ShouldBeTheSameAs(session); - stub2.AfterCommitSession.ShouldBeTheSameAs(session); + stub2.SaveChangesSession.ShouldBeSameAs(session); + stub2.AfterCommitSession.ShouldBeSameAs(session); } } } @@ -68,11 +68,11 @@ public async Task call_listener_events_on_synchronous_session_saves_async() await session.SaveChangesAsync(); - stub1.SaveChangesSession.ShouldBeTheSameAs(session); - stub1.AfterCommitSession.ShouldBeTheSameAs(session); + stub1.SaveChangesSession.ShouldBeSameAs(session); + stub1.AfterCommitSession.ShouldBeSameAs(session); - stub2.SaveChangesSession.ShouldBeTheSameAs(session); - stub2.AfterCommitSession.ShouldBeTheSameAs(session); + stub2.SaveChangesSession.ShouldBeSameAs(session); + stub2.AfterCommitSession.ShouldBeSameAs(session); } } diff --git a/src/DocumentDbTests/SessionMechanics/ejecting_documents.cs b/src/DocumentDbTests/SessionMechanics/ejecting_documents.cs index ff191c2f67..1448c2db67 100644 --- a/src/DocumentDbTests/SessionMechanics/ejecting_documents.cs +++ b/src/DocumentDbTests/SessionMechanics/ejecting_documents.cs @@ -21,8 +21,8 @@ public async Task demonstrate_eject() session.Store(target1, target2); // Both documents are in the identity map - session.Load(target1.Id).ShouldBeTheSameAs(target1); - session.Load(target2.Id).ShouldBeTheSameAs(target2); + session.Load(target1.Id).ShouldBeSameAs(target1); + session.Load(target2.Id).ShouldBeSameAs(target2); // Eject the 2nd document session.Eject(target2); @@ -52,8 +52,8 @@ public void eject_a_document_clears_it_from_the_identity_map_regular() { session.Store(target1, target2); - session.Load(target1.Id).ShouldBeTheSameAs(target1); - session.Load(target2.Id).ShouldBeTheSameAs(target2); + session.Load(target1.Id).ShouldBeSameAs(target1); + session.Load(target2.Id).ShouldBeSameAs(target2); session.Eject(target2); @@ -71,8 +71,8 @@ public void eject_a_document_clears_it_from_the_identity_map_dirty() { session.Store(target1, target2); - session.Load(target1.Id).ShouldBeTheSameAs(target1); - session.Load(target2.Id).ShouldBeTheSameAs(target2); + session.Load(target1.Id).ShouldBeSameAs(target1); + session.Load(target2.Id).ShouldBeSameAs(target2); session.Eject(target2); @@ -158,10 +158,10 @@ public async Task eject_a_document_type_clears_it_from_the_identity_map_regular( session.Store(target1, target2); session.Store(user1, user2); - session.Load(target1.Id).ShouldBeTheSameAs(target1); - session.Load(target2.Id).ShouldBeTheSameAs(target2); - session.Load(user1.Id).ShouldBeTheSameAs(user1); - session.Load(user2.Id).ShouldBeTheSameAs(user2); + session.Load(target1.Id).ShouldBeSameAs(target1); + session.Load(target2.Id).ShouldBeSameAs(target2); + session.Load(user1.Id).ShouldBeSameAs(user1); + session.Load(user2.Id).ShouldBeSameAs(user2); session.EjectAllOfType(typeof(Target)); @@ -172,8 +172,8 @@ public async Task eject_a_document_type_clears_it_from_the_identity_map_regular( session.Load(target1.Id).ShouldBeNull(); session.Load(target2.Id).ShouldBeNull(); - session.Load(user1.Id).ShouldBeTheSameAs(user1); - session.Load(user2.Id).ShouldBeTheSameAs(user2); + session.Load(user1.Id).ShouldBeSameAs(user1); + session.Load(user2.Id).ShouldBeSameAs(user2); } [Fact] @@ -188,10 +188,10 @@ public void eject_a_document_type_clears_it_from_the_identity_map_dirty() session.Store(target1, target2); session.Store(user1, user2); - session.Load(target1.Id).ShouldBeTheSameAs(target1); - session.Load(target2.Id).ShouldBeTheSameAs(target2); - session.Load(user1.Id).ShouldBeTheSameAs(user1); - session.Load(user2.Id).ShouldBeTheSameAs(user2); + session.Load(target1.Id).ShouldBeSameAs(target1); + session.Load(target2.Id).ShouldBeSameAs(target2); + session.Load(user1.Id).ShouldBeSameAs(user1); + session.Load(user2.Id).ShouldBeSameAs(user2); session.EjectAllOfType(typeof(Target)); @@ -200,8 +200,8 @@ public void eject_a_document_type_clears_it_from_the_identity_map_dirty() session.Load(target1.Id).ShouldBeNull(); session.Load(target2.Id).ShouldBeNull(); - session.Load(user1.Id).ShouldBeTheSameAs(user1); - session.Load(user2.Id).ShouldBeTheSameAs(user2); + session.Load(user1.Id).ShouldBeSameAs(user1); + session.Load(user2.Id).ShouldBeSameAs(user2); } [Fact] diff --git a/src/DocumentDbTests/SessionMechanics/identity_map_mechanics.cs b/src/DocumentDbTests/SessionMechanics/identity_map_mechanics.cs index d9061b849c..067cb5d9d8 100644 --- a/src/DocumentDbTests/SessionMechanics/identity_map_mechanics.cs +++ b/src/DocumentDbTests/SessionMechanics/identity_map_mechanics.cs @@ -207,8 +207,8 @@ public async Task opt_into_identity_map_with_lightweight_sessions() var target2 = await lightweight.LoadAsync(target.Id); var target3 = await lightweight.LoadAsync(target.Id); - target1.ShouldBeTheSameAs(target2); - target1.ShouldBeTheSameAs(target3); + target1.ShouldBeSameAs(target2); + target1.ShouldBeSameAs(target3); } public identity_map_mechanics(DefaultStoreFixture fixture): base(fixture) diff --git a/src/DocumentDbTests/Writing/Identity/using_int_identity.cs b/src/DocumentDbTests/Writing/Identity/using_int_identity.cs index b5005579d8..e9466e2191 100644 --- a/src/DocumentDbTests/Writing/Identity/using_int_identity.cs +++ b/src/DocumentDbTests/Writing/Identity/using_int_identity.cs @@ -18,9 +18,9 @@ public async Task persist_and_load() await theSession.SaveChangesAsync(); using var session = theStore.LightweightSession(); - SpecificationExtensions.ShouldNotBeNull(session.Load(456)); + session.Load(456).ShouldNotBeNull(); - SpecificationExtensions.ShouldBeNull(session.Load(222)); + session.Load(222).ShouldBeNull(); } [Fact] @@ -30,7 +30,7 @@ public void auto_assign_id_for_0_id() theSession.Store(doc); - SpecificationExtensions.ShouldBeGreaterThan(doc.Id, 0); + doc.Id.ShouldBeGreaterThan(0); var doc2 = new IntDoc {Id = 0}; theSession.Store(doc2); @@ -56,7 +56,7 @@ public async Task persist_and_delete() using (var session = theStore.QuerySession()) { - SpecificationExtensions.ShouldBeNull(session.Load(IntDoc.Id)); + session.Load(IntDoc.Id).ShouldBeNull(); } } diff --git a/src/DocumentDbTests/Writing/Identity/using_long_identity.cs b/src/DocumentDbTests/Writing/Identity/using_long_identity.cs index 6b36bae5d5..b182ab7331 100644 --- a/src/DocumentDbTests/Writing/Identity/using_long_identity.cs +++ b/src/DocumentDbTests/Writing/Identity/using_long_identity.cs @@ -30,7 +30,7 @@ public void auto_assign_id_for_0_id() theSession.Store(doc); - SpecificationExtensions.ShouldBeGreaterThan(doc.Id, 0L); + doc.Id.ShouldBeGreaterThan(0L); var doc2 = new LongDoc { Id = 0 }; theSession.Store(doc2); @@ -56,7 +56,7 @@ public async Task persist_and_delete() using (var session = theStore.QuerySession()) { - SpecificationExtensions.ShouldBeNull(session.Load(LongDoc.Id)); + session.Load(LongDoc.Id).ShouldBeNull(); } } diff --git a/src/DocumentDbTests/Writing/Identity/using_natural_identity_keys.cs b/src/DocumentDbTests/Writing/Identity/using_natural_identity_keys.cs index 7eed3a382d..af166c5efd 100644 --- a/src/DocumentDbTests/Writing/Identity/using_natural_identity_keys.cs +++ b/src/DocumentDbTests/Writing/Identity/using_natural_identity_keys.cs @@ -46,7 +46,7 @@ public async Task can_persist_with_natural_key() using (var query = theStore.QuerySession()) { - SpecificationExtensions.ShouldNotBeNull(query.Load("somebody")); + query.Load("somebody").ShouldNotBeNull(); } } diff --git a/src/DocumentDbTests/Writing/bulk_loading.cs b/src/DocumentDbTests/Writing/bulk_loading.cs index 42b7a20097..db70873bf3 100644 --- a/src/DocumentDbTests/Writing/bulk_loading.cs +++ b/src/DocumentDbTests/Writing/bulk_loading.cs @@ -148,7 +148,7 @@ public void load_with_small_batch_and_ignore_duplicates_smoke_test() theSession.Query().Count().ShouldBe(data.Length); - SpecificationExtensions.ShouldNotBeNull(theSession.Load(data[0].Id)); + theSession.Load(data[0].Id).ShouldNotBeNull(); var count = theSession.Connection.CreateCommand() .Sql($"select count(*) from {SchemaName}.mt_doc_target where mt_last_modified is null") @@ -168,7 +168,7 @@ public void load_with_small_batch_and_overwrites_smoke_test() theSession.Query().Count().ShouldBe(data.Length); - SpecificationExtensions.ShouldNotBeNull(theSession.Load(data[0].Id)); + theSession.Load(data[0].Id).ShouldNotBeNull(); } [Fact] diff --git a/src/DocumentDbTests/Writing/storing_documents.cs b/src/DocumentDbTests/Writing/storing_documents.cs index 27e595a815..9f8d781f1c 100644 --- a/src/DocumentDbTests/Writing/storing_documents.cs +++ b/src/DocumentDbTests/Writing/storing_documents.cs @@ -119,7 +119,7 @@ public void store_document_inherited_from_document_with_id_from_another_assembly using var session = theStore.IdentitySession(); var user = new UserFromBaseDocument(); session.Store(user); - session.Load(user.Id).ShouldBeTheSameAs(user); + session.Load(user.Id).ShouldBeSameAs(user); } [Theory] diff --git a/src/EventSourcingTests/Aggregation/CustomProjectionTests.cs b/src/EventSourcingTests/Aggregation/CustomProjectionTests.cs index df89a781b9..c5dafdd36f 100644 --- a/src/EventSourcingTests/Aggregation/CustomProjectionTests.cs +++ b/src/EventSourcingTests/Aggregation/CustomProjectionTests.cs @@ -54,13 +54,13 @@ public void caches_aggregate_caches_correctly() var cache2 = projection.CacheFor(tenant2); var cache3 = projection.CacheFor(tenant3); - projection.CacheFor(tenant1).ShouldBeTheSameAs(cache1); - projection.CacheFor(tenant2).ShouldBeTheSameAs(cache2); - projection.CacheFor(tenant3).ShouldBeTheSameAs(cache3); + projection.CacheFor(tenant1).ShouldBeSameAs(cache1); + projection.CacheFor(tenant2).ShouldBeSameAs(cache2); + projection.CacheFor(tenant3).ShouldBeSameAs(cache3); - cache1.ShouldNotBeTheSameAs(cache2); - cache1.ShouldNotBeTheSameAs(cache3); - cache2.ShouldNotBeTheSameAs(cache3); + cache1.ShouldNotBeSameAs(cache2); + cache1.ShouldNotBeSameAs(cache3); + cache2.ShouldNotBeSameAs(cache3); } [Fact] diff --git a/src/EventSourcingTests/Aggregation/LiveAggregatorBuilderTests.cs b/src/EventSourcingTests/Aggregation/LiveAggregatorBuilderTests.cs index d606c595e5..fc28b71a81 100644 --- a/src/EventSourcingTests/Aggregation/LiveAggregatorBuilderTests.cs +++ b/src/EventSourcingTests/Aggregation/LiveAggregatorBuilderTests.cs @@ -5,6 +5,7 @@ using Marten.Events; using Marten.Events.Aggregation; using Marten.Testing.Harness; +using Shouldly; using Xunit; namespace EventSourcingTests.Aggregation; diff --git a/src/EventSourcingTests/Aggregation/aggregation_projection_validation_rules.cs b/src/EventSourcingTests/Aggregation/aggregation_projection_validation_rules.cs index d9706e7c5f..a8d91646aa 100644 --- a/src/EventSourcingTests/Aggregation/aggregation_projection_validation_rules.cs +++ b/src/EventSourcingTests/Aggregation/aggregation_projection_validation_rules.cs @@ -54,8 +54,7 @@ public void aggregate_id_is_wrong_type_1() }); message.ShouldContain( - $"Id type mismatch", - StringComparisonOption.Default); + $"Id type mismatch"); } @@ -66,10 +65,7 @@ public void aggregate_id_is_wrong_type_2() { x.Events.StreamIdentity = StreamIdentity.AsString; x.Projections.Snapshot(SnapshotLifecycle.Async); - }).ShouldContain( - $"Id type mismatch", - StringComparisonOption.Default - ); + }).ShouldContain("Id type mismatch"); } [Fact] @@ -80,8 +76,7 @@ public void if_events_are_multi_tenanted_and_global_projections_are_disabled_so_ opts.Events.TenancyStyle = TenancyStyle.Conjoined; opts.Projections.Snapshot(SnapshotLifecycle.Async); }).ShouldContain( - $"Tenancy storage style mismatch between the events (Conjoined) and the aggregate type {typeof(GuidIdentifiedAggregate).FullNameInCode()} (Single)", - StringComparisonOption.Default); + $"Tenancy storage style mismatch between the events (Conjoined) and the aggregate type {typeof(GuidIdentifiedAggregate).FullNameInCode()} (Single)"); } [Fact] @@ -109,8 +104,7 @@ public void if_the_aggregate_is_multi_tenanted_but_the_events_are_not() opts.Projections.Snapshot(SnapshotLifecycle.Async); opts.Schema.For().MultiTenanted(); }).ShouldContain( - $"Tenancy storage style mismatch between the events (Single) and the aggregate type {typeof(GuidIdentifiedAggregate).FullNameInCode()} (Conjoined)", - StringComparisonOption.Default); + $"Tenancy storage style mismatch between the events (Single) and the aggregate type {typeof(GuidIdentifiedAggregate).FullNameInCode()} (Conjoined)"); } [Fact] @@ -171,8 +165,7 @@ public void find_bad_method_names_that_are_not_ignored() var ex = Should.Throw(() => projection.AssembleAndAssertValidity()); ex.Message.ShouldContain( - "Unrecognized method name 'DoStuff'. Either mark with [MartenIgnore] or use one of 'Apply', 'Create', 'ShouldDelete'", - StringComparisonOption.NormalizeWhitespaces); + "Unrecognized method name 'DoStuff'. Either mark with [MartenIgnore] or use one of 'Apply', 'Create', 'ShouldDelete'"); } [Fact] diff --git a/src/EventSourcingTests/Aggregation/fetching_async_aggregates_for_writing.cs b/src/EventSourcingTests/Aggregation/fetching_async_aggregates_for_writing.cs index 4ba73fca58..51d6dcab5a 100644 --- a/src/EventSourcingTests/Aggregation/fetching_async_aggregates_for_writing.cs +++ b/src/EventSourcingTests/Aggregation/fetching_async_aggregates_for_writing.cs @@ -52,7 +52,7 @@ public async Task fetch_new_stream_for_writing_Guid_identifier_exception_handlin var streamId = Guid.NewGuid(); var stream = await theSession.Events.FetchForWriting(streamId); - SpecificationExtensions.ShouldBeNull(stream.Aggregate); + stream.Aggregate.ShouldBeNull(); stream.CurrentVersion.ShouldBe(0); stream.AppendOne(new AEvent()); @@ -86,7 +86,7 @@ public async Task fetch_existing_stream_for_writing_Guid_identifier() var stream = await theSession.Events.FetchForWriting(streamId); - SpecificationExtensions.ShouldNotBeNull(stream.Aggregate); + stream.Aggregate.ShouldNotBeNull(); stream.CurrentVersion.ShouldBe(6); var document = stream.Aggregate; @@ -115,7 +115,7 @@ public async Task fetch_existing_stream_for_writing_Guid_identifier_multi_tenant await theSession.SaveChangesAsync(); var stream = await theSession.Events.FetchForWriting(streamId); - SpecificationExtensions.ShouldNotBeNull(stream.Aggregate); + stream.Aggregate.ShouldNotBeNull(); stream.CurrentVersion.ShouldBe(6); var document = stream.Aggregate; @@ -139,7 +139,7 @@ public async Task fetch_new_stream_for_writing_string_identifier() var streamId = Guid.NewGuid().ToString(); var stream = await theSession.Events.FetchForWriting(streamId); - SpecificationExtensions.ShouldBeNull(stream.Aggregate); + stream.Aggregate.ShouldBeNull(); stream.CurrentVersion.ShouldBe(0); stream.AppendOne(new AEvent()); @@ -171,7 +171,7 @@ public async Task fetch_existing_stream_for_writing_string_identifier() await theSession.SaveChangesAsync(); var stream = await theSession.Events.FetchForWriting(streamId); - SpecificationExtensions.ShouldNotBeNull(stream.Aggregate); + stream.Aggregate.ShouldNotBeNull(); stream.CurrentVersion.ShouldBe(6); var document = stream.Aggregate; @@ -201,7 +201,7 @@ public async Task fetch_existing_stream_for_writing_string_identifier_multi_tena await theSession.SaveChangesAsync(); var stream = await theSession.Events.FetchForWriting(streamId); - SpecificationExtensions.ShouldNotBeNull(stream.Aggregate); + stream.Aggregate.ShouldNotBeNull(); stream.CurrentVersion.ShouldBe(6); var document = stream.Aggregate; @@ -278,7 +278,7 @@ public async Task fetch_existing_stream_exclusively_happy_path_for_writing_strin await theSession.SaveChangesAsync(); var stream = await theSession.Events.FetchForExclusiveWriting(streamId); - SpecificationExtensions.ShouldNotBeNull(stream.Aggregate); + stream.Aggregate.ShouldNotBeNull(); stream.CurrentVersion.ShouldBe(6); var document = stream.Aggregate; @@ -335,7 +335,7 @@ public async Task fetch_existing_stream_for_writing_Guid_identifier_with_expecte await theSession.SaveChangesAsync(); var stream = await theSession.Events.FetchForWriting(streamId, 6); - SpecificationExtensions.ShouldNotBeNull(stream.Aggregate); + stream.Aggregate.ShouldNotBeNull(); stream.CurrentVersion.ShouldBe(6); stream.AppendOne(new EEvent()); diff --git a/src/EventSourcingTests/Aggregation/fetching_inline_aggregates_for_writing.cs b/src/EventSourcingTests/Aggregation/fetching_inline_aggregates_for_writing.cs index f63fd26204..010db5b19b 100644 --- a/src/EventSourcingTests/Aggregation/fetching_inline_aggregates_for_writing.cs +++ b/src/EventSourcingTests/Aggregation/fetching_inline_aggregates_for_writing.cs @@ -564,7 +564,7 @@ public async Task silently_turns_on_identity_map_for_inline_aggregates() // Should already be using the identity map var loadAgain = await session.LoadAsync(streamId); - loadAgain.ShouldBeTheSameAs(existing.Aggregate); + loadAgain.ShouldBeSameAs(existing.Aggregate); // Append to the stream and see that the existing aggregate is changed existing.AppendOne(new AEvent()); diff --git a/src/EventSourcingTests/Bugs/Bug_1019_event_type_not_found_bad_exception_message.cs b/src/EventSourcingTests/Bugs/Bug_1019_event_type_not_found_bad_exception_message.cs index 3090de80ec..e862f7db0c 100644 --- a/src/EventSourcingTests/Bugs/Bug_1019_event_type_not_found_bad_exception_message.cs +++ b/src/EventSourcingTests/Bugs/Bug_1019_event_type_not_found_bad_exception_message.cs @@ -2,6 +2,7 @@ using System.Threading.Tasks; using Marten.Exceptions; using Marten.Testing.Harness; +using Shouldly; using Weasel.Postgresql; using Xunit; diff --git a/src/EventSourcingTests/Bugs/Bug_1679_use_inner_type_for_stream_aggregation.cs b/src/EventSourcingTests/Bugs/Bug_1679_use_inner_type_for_stream_aggregation.cs index 93585ac4a6..c26e576d55 100644 --- a/src/EventSourcingTests/Bugs/Bug_1679_use_inner_type_for_stream_aggregation.cs +++ b/src/EventSourcingTests/Bugs/Bug_1679_use_inner_type_for_stream_aggregation.cs @@ -5,6 +5,7 @@ using Marten.Events; using Marten.Schema; using Marten.Testing.Harness; +using Shouldly; using Xunit; namespace EventSourcingTests.Bugs; diff --git a/src/EventSourcingTests/Bugs/Bug_2607_aggregate_projection_with_guid_argument.cs b/src/EventSourcingTests/Bugs/Bug_2607_aggregate_projection_with_guid_argument.cs index c1d1eab9bd..2081a0d63a 100644 --- a/src/EventSourcingTests/Bugs/Bug_2607_aggregate_projection_with_guid_argument.cs +++ b/src/EventSourcingTests/Bugs/Bug_2607_aggregate_projection_with_guid_argument.cs @@ -6,6 +6,7 @@ using Marten.Events; using Marten.Events.Aggregation; using Marten.Testing.Harness; +using Shouldly; using Xunit; using Xunit.Abstractions; diff --git a/src/EventSourcingTests/Bugs/Bug_3103_linq_query_against_event_id.cs b/src/EventSourcingTests/Bugs/Bug_3103_linq_query_against_event_id.cs index 32b3c55dfb..c549033646 100644 --- a/src/EventSourcingTests/Bugs/Bug_3103_linq_query_against_event_id.cs +++ b/src/EventSourcingTests/Bugs/Bug_3103_linq_query_against_event_id.cs @@ -3,6 +3,7 @@ using System.Threading.Tasks; using Marten; using Marten.Testing.Harness; +using Shouldly; using Xunit; namespace EventSourcingTests.Bugs; diff --git a/src/EventSourcingTests/Bugs/Bug_499_event_store_objects_should_not_be_erroneously_in_the_patch.cs b/src/EventSourcingTests/Bugs/Bug_499_event_store_objects_should_not_be_erroneously_in_the_patch.cs index 971a379987..b09fe88019 100644 --- a/src/EventSourcingTests/Bugs/Bug_499_event_store_objects_should_not_be_erroneously_in_the_patch.cs +++ b/src/EventSourcingTests/Bugs/Bug_499_event_store_objects_should_not_be_erroneously_in_the_patch.cs @@ -2,6 +2,7 @@ using Marten.Testing; using Marten.Testing.Documents; using Marten.Testing.Harness; +using Shouldly; using Xunit; namespace EventSourcingTests.Bugs; @@ -19,4 +20,4 @@ public async Task not_using_the_event_store_should_not_be_in_patch() patch.UpdateSql().ShouldNotContain("mt_streams"); } -} \ No newline at end of file +} diff --git a/src/EventSourcingTests/EventGraphTests.cs b/src/EventSourcingTests/EventGraphTests.cs index 326a82231f..d07c2d0b2d 100644 --- a/src/EventSourcingTests/EventGraphTests.cs +++ b/src/EventSourcingTests/EventGraphTests.cs @@ -78,7 +78,7 @@ public void register_event_types_and_retrieve() theGraph.AddEventType(typeof(MembersJoined)); theGraph.AddEventType(typeof(MembersDeparted)); - theGraph.EventMappingFor().ShouldBeTheSameAs(theGraph.EventMappingFor()); + theGraph.EventMappingFor().ShouldBeSameAs(theGraph.EventMappingFor()); } [Fact] diff --git a/src/EventSourcingTests/Projections/inline_aggregation_with_base_view_class.cs b/src/EventSourcingTests/Projections/inline_aggregation_with_base_view_class.cs index ed9ba4309f..3e50a399f6 100644 --- a/src/EventSourcingTests/Projections/inline_aggregation_with_base_view_class.cs +++ b/src/EventSourcingTests/Projections/inline_aggregation_with_base_view_class.cs @@ -61,7 +61,7 @@ private void VerifyProjection() where T : IMonstersView { var loadedView = theSession.Load(streamId); - loadedView.ShouldNotBeNull(); + loadedView.ShouldNotBe(default); loadedView.Id.ShouldBe(streamId); loadedView.Monsters.ShouldHaveTheSameElementsAs("Troll", "Dragon"); diff --git a/src/EventSourcingTests/Projections/inline_aggregation_with_custom_projection_configuration.cs b/src/EventSourcingTests/Projections/inline_aggregation_with_custom_projection_configuration.cs index ab5ac00e4d..19e13af9d3 100644 --- a/src/EventSourcingTests/Projections/inline_aggregation_with_custom_projection_configuration.cs +++ b/src/EventSourcingTests/Projections/inline_aggregation_with_custom_projection_configuration.cs @@ -4,6 +4,7 @@ using Marten.Events.Projections; using Marten.Testing.Harness; using NSubstitute; +using Shouldly; using Xunit; namespace EventSourcingTests.Projections; diff --git a/src/EventSourcingTests/Projections/inline_aggregation_with_private_constructor.cs b/src/EventSourcingTests/Projections/inline_aggregation_with_private_constructor.cs index 4ced92ebe1..65ed92d52d 100644 --- a/src/EventSourcingTests/Projections/inline_aggregation_with_private_constructor.cs +++ b/src/EventSourcingTests/Projections/inline_aggregation_with_private_constructor.cs @@ -51,7 +51,7 @@ private async Task Verify() where T : IMonstersView var loadedView = theSession.Load(streamId); - loadedView.ShouldNotBeNull(); + loadedView.ShouldNotBe(default); loadedView!.Id.ShouldBe(streamId); loadedView.Monsters.ShouldHaveTheSameElementsAs("Troll", "Dragon"); diff --git a/src/EventSourcingTests/QuickAppend/quick_append_event_capture_and_fetching_the_stream.cs b/src/EventSourcingTests/QuickAppend/quick_append_event_capture_and_fetching_the_stream.cs index f70fa6067a..9c62c5a0ae 100644 --- a/src/EventSourcingTests/QuickAppend/quick_append_event_capture_and_fetching_the_stream.cs +++ b/src/EventSourcingTests/QuickAppend/quick_append_event_capture_and_fetching_the_stream.cs @@ -242,7 +242,7 @@ await When.CalledForEachAsync(tenants, async (tenantId, index) => using (var session = store.LightweightSession(tenantId)) { var party = session.Load(questId); - SpecificationExtensions.ShouldNotBeNull(party); + party.ShouldNotBeNull(); } //GetAll @@ -251,7 +251,7 @@ await When.CalledForEachAsync(tenants, async (tenantId, index) => var parties = session.Events.QueryRawEventDataOnly().ToArray(); foreach (var party in parties) { - SpecificationExtensions.ShouldNotBeNull(party); + party.ShouldNotBeNull(); } } @@ -502,7 +502,7 @@ await When.CalledForEachAsync(tenants, async (tenantId, index) => streamEvents.ElementAt(1).Data.ShouldBeOfType(); streamEvents.ElementAt(1).Version.ShouldBe(2); - streamEvents.Each(x => SpecificationExtensions.ShouldBeGreaterThan(x.Sequence, 0L)); + streamEvents.Each(x => x.Sequence.ShouldBeGreaterThan(0L)); } }).ShouldSucceedAsync(); } @@ -613,40 +613,6 @@ await When.CalledForEachAsync(tenants, async (tenantId, index) => ); } - [Theory] - [MemberData(nameof(SessionParams))] - public async Task capture_immutable_events(TenancyStyle tenancyStyle, string[] tenants) - { - var store = ConfigureStore(tenancyStyle); - - var id = Guid.NewGuid(); - - await When.CalledForEachAsync(tenants, async (tenantId, index) => - { - var immutableEvent = new ImmutableEvent(id, "some-name"); - - using (var session = store.LightweightSession(tenantId)) - { - session.Events.Append(id, immutableEvent); - await session.SaveChangesAsync(); - } - - using (var session = store.LightweightSession(tenantId)) - { - var streamEvents = await session.Events.FetchStreamAsync(id); - - streamEvents.Count.ShouldBe(1); - var @event = streamEvents.ElementAt(0).Data.ShouldBeOfType(); - - @event.Id.ShouldBe(id); - @event.Name.ShouldBe("some-name"); - } - }).ShouldThrowIfAsync( - (tenancyStyle == TenancyStyle.Single && tenants.Length > 1) || - (tenancyStyle == TenancyStyle.Conjoined && tenants.SequenceEqual(SameTenants)) - ); - } - private DocumentStore ConfigureStore(TenancyStyle tenancyStyle, bool cleanSchema = true) { var store = StoreOptions(opts => diff --git a/src/EventSourcingTests/QuickAppend/quick_append_event_capture_and_fetching_the_stream_with_string_identifiers.cs b/src/EventSourcingTests/QuickAppend/quick_append_event_capture_and_fetching_the_stream_with_string_identifiers.cs index 8df0fce859..e4f85c970d 100644 --- a/src/EventSourcingTests/QuickAppend/quick_append_event_capture_and_fetching_the_stream_with_string_identifiers.cs +++ b/src/EventSourcingTests/QuickAppend/quick_append_event_capture_and_fetching_the_stream_with_string_identifiers.cs @@ -245,7 +245,7 @@ public async Task query_before_saving() await session.SaveChangesAsync(); var party = await session.Events.AggregateStreamAsync(questId); - SpecificationExtensions.ShouldNotBeNull(party); + party.ShouldNotBeNull(); } } @@ -273,7 +273,7 @@ public async Task aggregate_stream_async_has_the_id() await session.SaveChangesAsync(); var party = await session.Events.AggregateStreamAsync(questId); - SpecificationExtensions.ShouldNotBeNull(party); + party.ShouldNotBeNull(); } } diff --git a/src/EventSourcingTests/QuickAppend/quick_append_events_with_optimistic_or_exclusive_locks.cs b/src/EventSourcingTests/QuickAppend/quick_append_events_with_optimistic_or_exclusive_locks.cs index c2e5c5f846..309f517fa6 100644 --- a/src/EventSourcingTests/QuickAppend/quick_append_events_with_optimistic_or_exclusive_locks.cs +++ b/src/EventSourcingTests/QuickAppend/quick_append_events_with_optimistic_or_exclusive_locks.cs @@ -132,8 +132,7 @@ public async Task append_exclusive_sad_path_with_concurrency_issue() await session.SaveChangesAsync(); }); - ex.Message.ShouldContain(MartenCommandException.MaybeLockedRowsMessage, - StringComparisonOption.Default); + ex.Message.ShouldContain(MartenCommandException.MaybeLockedRowsMessage); } } @@ -259,8 +258,7 @@ public async Task append_exclusive_sad_path_with_concurrency_issue() await session.SaveChangesAsync(); }); - ex.Message.ShouldContain(MartenCommandException.MaybeLockedRowsMessage, - StringComparisonOption.Default); + ex.Message.ShouldContain(MartenCommandException.MaybeLockedRowsMessage); } } diff --git a/src/EventSourcingTests/append_events_with_optimistic_or_exclusive_locks.cs b/src/EventSourcingTests/append_events_with_optimistic_or_exclusive_locks.cs index 01bcf29f95..5900c37a5a 100644 --- a/src/EventSourcingTests/append_events_with_optimistic_or_exclusive_locks.cs +++ b/src/EventSourcingTests/append_events_with_optimistic_or_exclusive_locks.cs @@ -120,8 +120,7 @@ public async Task append_exclusive_sad_path_with_concurrency_issue() await session.SaveChangesAsync(); }); - ex.Message.ShouldContain(MartenCommandException.MaybeLockedRowsMessage, - StringComparisonOption.Default); + ex.Message.ShouldContain(MartenCommandException.MaybeLockedRowsMessage); } } @@ -247,8 +246,7 @@ public async Task append_exclusive_sad_path_with_concurrency_issue() await session.SaveChangesAsync(); }); - ex.Message.ShouldContain(MartenCommandException.MaybeLockedRowsMessage, - StringComparisonOption.Default); + ex.Message.ShouldContain(MartenCommandException.MaybeLockedRowsMessage); } } diff --git a/src/EventSourcingTests/capturing_event_versions_on_existing_streams_after_append.cs b/src/EventSourcingTests/capturing_event_versions_on_existing_streams_after_append.cs index a183fcfd0d..4cce267c88 100644 --- a/src/EventSourcingTests/capturing_event_versions_on_existing_streams_after_append.cs +++ b/src/EventSourcingTests/capturing_event_versions_on_existing_streams_after_append.cs @@ -77,7 +77,7 @@ public async Task running_synchronously() events.Select(x => x.Version) .ShouldHaveTheSameElementsAs(1, 2); - events.Each(x => SpecificationExtensions.ShouldBeGreaterThan(x.Sequence, 0L)); + events.Each(x => x.Sequence.ShouldBeGreaterThan(0L)); events.Select(x => x.Sequence).Distinct().Count().ShouldBe(2); } @@ -159,7 +159,7 @@ public async Task running_asynchronously() events.Select(x => x.Version) .ShouldHaveTheSameElementsAs(5, 6); - events.Each(x => SpecificationExtensions.ShouldBeGreaterThan(x.Sequence, 0L)); + events.Each(x => x.Sequence.ShouldBeGreaterThan(0L)); events.Select(x => x.Sequence).Distinct().Count().ShouldBe(2); } diff --git a/src/EventSourcingTests/end_to_end_event_capture_and_fetching_the_stream_Tests.cs b/src/EventSourcingTests/end_to_end_event_capture_and_fetching_the_stream_Tests.cs index 8469774475..815a7130c5 100644 --- a/src/EventSourcingTests/end_to_end_event_capture_and_fetching_the_stream_Tests.cs +++ b/src/EventSourcingTests/end_to_end_event_capture_and_fetching_the_stream_Tests.cs @@ -258,7 +258,7 @@ await When.CalledForEachAsync(tenants, async (tenantId, index) => using (var session = store.LightweightSession(tenantId)) { var party = session.Load(questId); - SpecificationExtensions.ShouldNotBeNull(party); + party.ShouldNotBeNull(); } //GetAll @@ -267,7 +267,7 @@ await When.CalledForEachAsync(tenants, async (tenantId, index) => var parties = session.Events.QueryRawEventDataOnly().ToArray(); foreach (var party in parties) { - SpecificationExtensions.ShouldNotBeNull(party); + party.ShouldNotBeNull(); } } @@ -522,7 +522,7 @@ await When.CalledForEachAsync(tenants, async (tenantId, index) => streamEvents.ElementAt(1).Data.ShouldBeOfType(); streamEvents.ElementAt(1).Version.ShouldBe(2); - streamEvents.Each(x => SpecificationExtensions.ShouldBeGreaterThan(x.Sequence, 0L)); + streamEvents.Each(x => x.Sequence.ShouldBeGreaterThan(0L)); } }).ShouldSucceedAsync(); } @@ -643,39 +643,6 @@ await When.CalledForEachAsync(tenants, async (tenantId, index) => ); } - [Theory] - [MemberData(nameof(SessionParams))] - public async Task capture_immutable_events(TenancyStyle tenancyStyle, string[] tenants) - { - var store = InitStore(tenancyStyle); - - await When.CalledForEachAsync(tenants, async (tenantId, index) => - { - var id = Guid.NewGuid(); - var immutableEvent = new ImmutableEvent(id, "some-name"); - - using (var session = store.LightweightSession(tenantId)) - { - session.Events.Append(id, immutableEvent); - await session.SaveChangesAsync(); - } - - using (var session = store.LightweightSession(tenantId)) - { - var streamEvents = await session.Events.FetchStreamAsync(id); - - streamEvents.Count.ShouldBe(1); - var @event = streamEvents.ElementAt(0).Data.ShouldBeOfType(); - - @event.Id.ShouldBe(id); - @event.Name.ShouldBe("some-name"); - } - }).ShouldThrowIfAsync( - (tenancyStyle == TenancyStyle.Single && tenants.Length > 1) || - (tenancyStyle == TenancyStyle.Conjoined && tenants.SequenceEqual(SameTenants)) - ); - } - private DocumentStore InitStore(TenancyStyle tenancyStyle, bool cleanSchema = true, bool useAppendEventForUpdateLock = false) { diff --git a/src/EventSourcingTests/end_to_end_event_capture_and_fetching_the_stream_with_string_identifiers.cs b/src/EventSourcingTests/end_to_end_event_capture_and_fetching_the_stream_with_string_identifiers.cs index e492fe62ce..fe223e390b 100644 --- a/src/EventSourcingTests/end_to_end_event_capture_and_fetching_the_stream_with_string_identifiers.cs +++ b/src/EventSourcingTests/end_to_end_event_capture_and_fetching_the_stream_with_string_identifiers.cs @@ -185,7 +185,7 @@ public async Task open_persisted_stream_in_new_store_with_same_settings() using (var session = theStore.LightweightSession()) { var party = session.Load(questId); - SpecificationExtensions.ShouldNotBeNull(party); + party.ShouldNotBeNull(); } var newStore = new DocumentStore(theStore.Options); @@ -248,7 +248,7 @@ public async Task query_before_saving() await session.SaveChangesAsync(); var party = await session.Events.AggregateStreamAsync(questId); - SpecificationExtensions.ShouldNotBeNull(party); + party.ShouldNotBeNull(); } } @@ -276,7 +276,7 @@ public async Task aggregate_stream_async_has_the_id() await session.SaveChangesAsync(); var party = await session.Events.AggregateStreamAsync(questId); - SpecificationExtensions.ShouldNotBeNull(party); + party.ShouldNotBeNull(); } } diff --git a/src/EventSourcingTests/fetch_a_single_event_with_metadata.cs b/src/EventSourcingTests/fetch_a_single_event_with_metadata.cs index 191766fa9d..fe596ccae9 100644 --- a/src/EventSourcingTests/fetch_a_single_event_with_metadata.cs +++ b/src/EventSourcingTests/fetch_a_single_event_with_metadata.cs @@ -84,9 +84,9 @@ public async Task fetch_synchronously() .StartStream(started, joined, slayed1, slayed2, joined2).Id; await theSession.SaveChangesAsync(); - var events = theSession.Events.FetchStream(streamId); + var events = await theSession.Events.FetchStreamAsync(streamId); - SpecificationExtensions.ShouldBeNull(theSession.Events.Load(Guid.NewGuid())); + theSession.Events.Load(Guid.NewGuid()).ShouldBeNull(); // Knowing the event type var slayed1_2 = theSession.Events.Load(events[2].Id); @@ -108,8 +108,8 @@ public async Task fetch_asynchronously() var events = await theSession.Events.FetchStreamAsync(streamId); - SpecificationExtensions.ShouldBeNull((await theSession.Events.LoadAsync(Guid.NewGuid()))); - SpecificationExtensions.ShouldBeNull((await theSession.Events.LoadAsync(Guid.NewGuid()))); + (await theSession.Events.LoadAsync(Guid.NewGuid())).ShouldBeNull(); + (await theSession.Events.LoadAsync(Guid.NewGuid())).ShouldBeNull(); // Knowing the event type var slayed1_2 = await theSession.Events.LoadAsync(events[2].Id); @@ -146,7 +146,7 @@ public async Task fetch_in_batch_query() (await slayed2_2).ShouldBeOfType>() .Data.Name.ShouldBe("Dragon"); - SpecificationExtensions.ShouldBeNull((await missing)); + (await missing).ShouldBeNull(); } public fetch_a_single_event_with_metadata(DefaultStoreFixture fixture): base(fixture) diff --git a/src/EventSourcingTests/querying_event_data_with_linq.cs b/src/EventSourcingTests/querying_event_data_with_linq.cs index 0304f5501a..1a4de9d899 100644 --- a/src/EventSourcingTests/querying_event_data_with_linq.cs +++ b/src/EventSourcingTests/querying_event_data_with_linq.cs @@ -73,8 +73,8 @@ public async Task can_query_against_event_metadata() .Take(3) .ToCommand().CommandText; - sql.ShouldNotContain("d.data ->> 'EventTypeName' = :p1", StringComparisonOption.Default); - sql.ShouldNotContain("d.data ->> 'DotNetTypeName' = :p2", StringComparisonOption.Default); + sql.ShouldNotContain("d.data ->> 'EventTypeName' = :p1"); + sql.ShouldNotContain("d.data ->> 'DotNetTypeName' = :p2"); } [Fact] diff --git a/src/LinqTests/Acceptance/diagnostic_methods.cs b/src/LinqTests/Acceptance/diagnostic_methods.cs index 4c579c1c17..c710e4a6d2 100644 --- a/src/LinqTests/Acceptance/diagnostic_methods.cs +++ b/src/LinqTests/Acceptance/diagnostic_methods.cs @@ -35,10 +35,10 @@ public async Task retrieves_query_plan() await theSession.SaveChangesAsync(); var plan = theSession.Query().Explain(); - SpecificationExtensions.ShouldNotBeNull(plan); - SpecificationExtensions.ShouldBeGreaterThan(plan.PlanWidth, 0); - SpecificationExtensions.ShouldBeGreaterThan(plan.PlanRows, 0); - SpecificationExtensions.ShouldBeGreaterThan(plan.TotalCost, 0m); + plan.ShouldNotBeNull(); + plan.PlanWidth.ShouldBeGreaterThan(0); + plan.PlanRows.ShouldBeGreaterThan(0); + plan.TotalCost.ShouldBeGreaterThan(0m); } [Fact] @@ -62,10 +62,10 @@ public async Task retrieves_query_plan_with_where() await theSession.SaveChangesAsync(); var plan = theSession.Query().Where(u => u.Number > 5).Explain(); - SpecificationExtensions.ShouldNotBeNull(plan); - SpecificationExtensions.ShouldBeGreaterThan(plan.PlanWidth, 0); - SpecificationExtensions.ShouldBeGreaterThan(plan.PlanRows, 0); - SpecificationExtensions.ShouldBeGreaterThan(plan.TotalCost, 0m); + plan.ShouldNotBeNull(); + plan.PlanWidth.ShouldBeGreaterThan(0); + plan.PlanRows.ShouldBeGreaterThan(0); + plan.TotalCost.ShouldBeGreaterThan(0m); } [Fact] @@ -99,10 +99,10 @@ public async Task retrieves_query_plan_with_where_and_all_options_enabled() .Timing() .Verbose(); }); - SpecificationExtensions.ShouldNotBeNull(plan); - SpecificationExtensions.ShouldBeGreaterThan(plan.ActualTotalTime, 0m); - SpecificationExtensions.ShouldBeGreaterThan(plan.PlanningTime, 0m); - SpecificationExtensions.ShouldBeGreaterThan(plan.ExecutionTime, 0m); + plan.ShouldNotBeNull(); + plan.ActualTotalTime.ShouldBeGreaterThan(0m); + plan.PlanningTime.ShouldBeGreaterThan(0m); + plan.ExecutionTime.ShouldBeGreaterThan(0m); plan.SortKey.ShouldContain("(((d.data ->> 'Number'::text))::integer)"); plan.Plans.ShouldNotBeEmpty(); } diff --git a/src/LinqTests/Acceptance/identity_map_mechanics.cs b/src/LinqTests/Acceptance/identity_map_mechanics.cs index 9f4ed41000..7c43d9ba8f 100644 --- a/src/LinqTests/Acceptance/identity_map_mechanics.cs +++ b/src/LinqTests/Acceptance/identity_map_mechanics.cs @@ -3,6 +3,7 @@ using Marten; using Marten.Testing.Documents; using Marten.Testing.Harness; +using Shouldly; namespace LinqTests.Acceptance; @@ -33,7 +34,7 @@ private async Task identitySessionWithData() await session.SaveChangesAsync(); - (await session.LoadAsync(user1.Id)).ShouldBeTheSameAs(user1); + (await session.LoadAsync(user1.Id)).ShouldBeSameAs(user1); return session; } @@ -43,10 +44,10 @@ public async Task single_runs_through_the_identity_map() { await using var session = await identitySessionWithData(); session.Query() - .Single(x => x.FirstName == "Jeremy").ShouldBeTheSameAs(user1); + .Single(x => x.FirstName == "Jeremy").ShouldBeSameAs(user1); session.Query() - .SingleOrDefault(x => x.FirstName == user4.FirstName).ShouldBeTheSameAs(user4); + .SingleOrDefault(x => x.FirstName == user4.FirstName).ShouldBeSameAs(user4); } @@ -55,11 +56,11 @@ public async Task first_runs_through_the_identity_map() { await using var session = await identitySessionWithData(); session.Query().Where(x => x.FirstName.StartsWith("J")).OrderBy(x => x.FirstName) - .First().ShouldBeTheSameAs(user3); + .First().ShouldBeSameAs(user3); session.Query().Where(x => x.FirstName.StartsWith("J")).OrderBy(x => x.FirstName) - .FirstOrDefault().ShouldBeTheSameAs(user3); + .FirstOrDefault().ShouldBeSameAs(user3); } [Fact] @@ -69,9 +70,9 @@ public async Task query_runs_through_identity_map() var users = session.Query().Where(x => x.FirstName.StartsWith("J")).OrderBy(x => x.FirstName) .ToArray(); - users[0].ShouldBeTheSameAs(user3); - users[1].ShouldBeTheSameAs(user2); - users[2].ShouldBeTheSameAs(user1); + users[0].ShouldBeSameAs(user3); + users[1].ShouldBeSameAs(user2); + users[2].ShouldBeSameAs(user1); } [Fact] @@ -81,12 +82,12 @@ public async Task single_runs_through_the_identity_map_async() var u1 = await session.Query().Where(x => x.FirstName == "Jeremy") .SingleAsync(); - u1.ShouldBeTheSameAs(user1); + u1.ShouldBeSameAs(user1); var u2 = await session.Query().Where(x => x.FirstName == user4.FirstName) .SingleOrDefaultAsync(); - u2.ShouldBeTheSameAs(user4); + u2.ShouldBeSameAs(user4); } @@ -97,13 +98,13 @@ public async Task first_runs_through_the_identity_map_async() var u1 = await session.Query().Where(x => x.FirstName.StartsWith("J")).OrderBy(x => x.FirstName) .FirstAsync(); - u1.ShouldBeTheSameAs(user3); + u1.ShouldBeSameAs(user3); var u2 = await session.Query().Where(x => x.FirstName.StartsWith("J")).OrderBy(x => x.FirstName) .FirstOrDefaultAsync(); - u2.ShouldBeTheSameAs(user3); + u2.ShouldBeSameAs(user3); } @@ -114,8 +115,8 @@ public async Task query_runs_through_identity_map_async() var users = await session.Query().Where(x => x.FirstName.StartsWith("J")).OrderBy(x => x.FirstName) .ToListAsync(); - users[0].ShouldBeTheSameAs(user3); - users[1].ShouldBeTheSameAs(user2); - users[2].ShouldBeTheSameAs(user1); + users[0].ShouldBeSameAs(user3); + users[1].ShouldBeSameAs(user2); + users[2].ShouldBeSameAs(user1); } } diff --git a/src/LinqTests/Acceptance/select_clause_usage.cs b/src/LinqTests/Acceptance/select_clause_usage.cs index 58dabafb37..b97392c4e0 100644 --- a/src/LinqTests/Acceptance/select_clause_usage.cs +++ b/src/LinqTests/Acceptance/select_clause_usage.cs @@ -201,8 +201,8 @@ public async Task use_select_with_multiple_fields_in_anonymous() users.Each(x => { - SpecificationExtensions.ShouldNotBeNull(x.First); - SpecificationExtensions.ShouldNotBeNull(x.Last); + x.First.ShouldNotBeNull(); + x.Last.ShouldNotBeNull(); }); } @@ -223,8 +223,8 @@ public async Task use_select_with_multiple_fields_to_other_type() users.Each(x => { - SpecificationExtensions.ShouldNotBeNull(x.First); - SpecificationExtensions.ShouldNotBeNull(x.Last); + x.First.ShouldNotBeNull(); + x.Last.ShouldNotBeNull(); }); } @@ -255,8 +255,8 @@ public async Task use_select_with_multiple_fields_to_other_type_using_constructo users.Each(x => { - SpecificationExtensions.ShouldNotBeNull(x.FirstName); - SpecificationExtensions.ShouldNotBeNull(x.LastName); + x.FirstName.ShouldNotBeNull(); + x.LastName.ShouldNotBeNull(); }); } @@ -278,9 +278,9 @@ public async Task use_select_with_multiple_fields_to_other_type_using_constructo users.Each(x => { - SpecificationExtensions.ShouldNotBeNull(x.FirstName); - SpecificationExtensions.ShouldNotBeNull(x.LastName); - SpecificationExtensions.ShouldBeGreaterThan(x.YearsOld, 0); + x.FirstName.ShouldNotBeNull(); + x.LastName.ShouldNotBeNull(); + x.YearsOld.ShouldBeGreaterThan(0); }); } diff --git a/src/LinqTests/Acceptance/select_many.cs b/src/LinqTests/Acceptance/select_many.cs index f20ff91799..1254cc6215 100644 --- a/src/LinqTests/Acceptance/select_many.cs +++ b/src/LinqTests/Acceptance/select_many.cs @@ -203,7 +203,7 @@ public async Task select_many_with_count_when_none_match_does_not_throw_async() .Where(p => p.Tags.Length == 1) .SelectMany(x => x.Tags); var ex = await Record.ExceptionAsync(() => queryable.CountAsync()); - SpecificationExtensions.ShouldBeNull(ex); + ex.ShouldBeNull(); } } @@ -213,7 +213,7 @@ public async Task select_many_against_complex_type_without_transformation() var targets = Target.GenerateRandomData(10).ToArray(); var expectedCount = targets.SelectMany(x => x.Children).Count(); - SpecificationExtensions.ShouldBeGreaterThan(expectedCount, 0); + expectedCount.ShouldBeGreaterThan(0); using (var session = theStore.LightweightSession()) { diff --git a/src/LinqTests/Acceptance/statistics_and_paged_list.cs b/src/LinqTests/Acceptance/statistics_and_paged_list.cs index 9484bb157f..caab68a346 100644 --- a/src/LinqTests/Acceptance/statistics_and_paged_list.cs +++ b/src/LinqTests/Acceptance/statistics_and_paged_list.cs @@ -117,7 +117,7 @@ public async Task can_use_json_streaming_with_statistics() public async Task can_get_the_total_from_a_compiled_query_running_in_a_batch() { var count = await theSession.Query().Where(x => x.Number > 10).CountAsync(); - SpecificationExtensions.ShouldBeGreaterThan(count, 0); + count.ShouldBeGreaterThan(0); var query = new TargetPaginationQuery(2, 5); @@ -137,7 +137,7 @@ public async Task can_get_the_total_from_a_compiled_query_running_in_a_batch() public void can_get_the_total_from_a_compiled_query_running_in_a_batch_sync() { var count = theSession.Query().Count(x => x.Number > 10); - SpecificationExtensions.ShouldBeGreaterThan(count, 0); + count.ShouldBeGreaterThan(0); var query = new TargetPaginationQuery(2, 5); @@ -157,7 +157,7 @@ public void can_get_the_total_from_a_compiled_query_running_in_a_batch_sync() public async Task can_get_the_total_in_batch_query() { var count = await theSession.Query().Where(x => x.Number > 10).CountAsync(); - SpecificationExtensions.ShouldBeGreaterThan(count, 0); + count.ShouldBeGreaterThan(0); QueryStatistics stats = null; @@ -177,7 +177,7 @@ public async Task can_get_the_total_in_batch_query() public void can_get_the_total_in_batch_query_sync() { var count = theSession.Query().Count(x => x.Number > 10); - SpecificationExtensions.ShouldBeGreaterThan(count, 0); + count.ShouldBeGreaterThan(0); QueryStatistics stats = null; @@ -198,7 +198,7 @@ public void can_get_the_total_in_batch_query_sync() public void can_get_the_total_in_results() { var count = theSession.Query().Count(x => x.Number > 10); - SpecificationExtensions.ShouldBeGreaterThan(count, 0); + count.ShouldBeGreaterThan(0); // We're going to use stats as an output // parameter to the call below, so we @@ -225,7 +225,7 @@ public void can_get_the_total_in_results() public async Task can_get_the_total_in_results_async() { var count = await theSession.Query().Where(x => x.Number > 10).CountAsync(); - SpecificationExtensions.ShouldBeGreaterThan(count, 0); + count.ShouldBeGreaterThan(0); QueryStatistics stats = null; @@ -297,7 +297,7 @@ public async Task invalid_pagenumber_should_throw_exception(Func( async () => await toPagedList(theSession.Query(), pageNumber, pageSize)); - SpecificationExtensions.ShouldContain(ex.Message, "pageNumber = 0. PageNumber cannot be below 1."); + ex.Message.ShouldContain("pageNumber = 0. PageNumber cannot be below 1."); } [Theory] @@ -312,7 +312,7 @@ public async Task invalid_pagesize_should_throw_exception(Func( async () => await toPagedList(theSession.Query(), pageNumber, pageSize)); - SpecificationExtensions.ShouldContain(ex.Message, $"pageSize = 0. PageSize cannot be below 1."); + ex.Message.ShouldContain($"pageSize = 0. PageSize cannot be below 1."); } [Theory] diff --git a/src/LinqTests/Bugs/Bug_1189_can_select_transform_without_an_id.cs b/src/LinqTests/Bugs/Bug_1189_can_select_transform_without_an_id.cs index b6fb0dc390..235c168d60 100644 --- a/src/LinqTests/Bugs/Bug_1189_can_select_transform_without_an_id.cs +++ b/src/LinqTests/Bugs/Bug_1189_can_select_transform_without_an_id.cs @@ -2,6 +2,7 @@ using Marten.Services.Json; using Marten.Testing.Documents; using Marten.Testing.Harness; +using Shouldly; namespace LinqTests.Bugs; diff --git a/src/LinqTests/Bugs/Bug_1245_include_plus_full_text_search.cs b/src/LinqTests/Bugs/Bug_1245_include_plus_full_text_search.cs index 60076969b9..f110ff55ac 100644 --- a/src/LinqTests/Bugs/Bug_1245_include_plus_full_text_search.cs +++ b/src/LinqTests/Bugs/Bug_1245_include_plus_full_text_search.cs @@ -4,6 +4,7 @@ using System.Threading.Tasks; using Marten; using Marten.Testing.Harness; +using Shouldly; namespace LinqTests.Bugs; diff --git a/src/LinqTests/Bugs/Bug_1413_not_inside_of_where_against_child_collection.cs b/src/LinqTests/Bugs/Bug_1413_not_inside_of_where_against_child_collection.cs index d60813be11..824c7832c1 100644 --- a/src/LinqTests/Bugs/Bug_1413_not_inside_of_where_against_child_collection.cs +++ b/src/LinqTests/Bugs/Bug_1413_not_inside_of_where_against_child_collection.cs @@ -1,6 +1,7 @@ using System.Linq; using Marten.Testing.Documents; using Marten.Testing.Harness; +using Shouldly; using Xunit.Abstractions; namespace LinqTests.Bugs; @@ -22,4 +23,4 @@ public void can_do_so() results.ShouldNotBeNull(); } -} \ No newline at end of file +} diff --git a/src/LinqTests/Bugs/Bug_1886_compiled_query_value_retention.cs b/src/LinqTests/Bugs/Bug_1886_compiled_query_value_retention.cs index 8c77228a83..beda3ead97 100644 --- a/src/LinqTests/Bugs/Bug_1886_compiled_query_value_retention.cs +++ b/src/LinqTests/Bugs/Bug_1886_compiled_query_value_retention.cs @@ -5,6 +5,7 @@ using Marten.Linq; using Marten.Schema; using Marten.Testing.Harness; +using Shouldly; namespace LinqTests.Bugs; @@ -68,4 +69,4 @@ public async Task Should_be_able_to_run_query_multiple_times() foundUser.ShouldNotBeNull(); } } -} \ No newline at end of file +} diff --git a/src/LinqTests/Bugs/Bug_260_Take_Skip_with_Select_Tests.cs b/src/LinqTests/Bugs/Bug_260_Take_Skip_with_Select_Tests.cs index 6d4715eadd..a6ac394fde 100644 --- a/src/LinqTests/Bugs/Bug_260_Take_Skip_with_Select_Tests.cs +++ b/src/LinqTests/Bugs/Bug_260_Take_Skip_with_Select_Tests.cs @@ -22,7 +22,7 @@ public void return_the_correct_number_of_results() var cmd = queryable.ToCommand(FetchType.FetchMany); - SpecificationExtensions.ShouldContain(cmd.CommandText, "LIMIT :p1"); + cmd.CommandText.ShouldContain("LIMIT :p1"); cmd.Parameters["p1"].Value.ShouldBe(10); @@ -32,4 +32,4 @@ public void return_the_correct_number_of_results() public Bug_260_Take_Skip_with_Select_Tests(DefaultStoreFixture fixture) : base(fixture) { } -} \ No newline at end of file +} diff --git a/src/LinqTests/Bugs/Bug_2618_Include_with_AnyTenant.cs b/src/LinqTests/Bugs/Bug_2618_Include_with_AnyTenant.cs index eca86522c6..a8c216bd05 100644 --- a/src/LinqTests/Bugs/Bug_2618_Include_with_AnyTenant.cs +++ b/src/LinqTests/Bugs/Bug_2618_Include_with_AnyTenant.cs @@ -4,6 +4,7 @@ using Marten; using Marten.Testing.Documents; using Marten.Testing.Harness; +using Shouldly; using Xunit.Abstractions; namespace LinqTests.Bugs; diff --git a/src/LinqTests/Bugs/Bug_276_Query_by_abstract_type_in_hierarchy.cs b/src/LinqTests/Bugs/Bug_276_Query_by_abstract_type_in_hierarchy.cs index dce9fcc86f..8853bd02e4 100644 --- a/src/LinqTests/Bugs/Bug_276_Query_by_abstract_type_in_hierarchy.cs +++ b/src/LinqTests/Bugs/Bug_276_Query_by_abstract_type_in_hierarchy.cs @@ -1,6 +1,7 @@ using System; using System.Threading.Tasks; using Marten.Testing.Harness; +using Shouldly; namespace LinqTests.Bugs; @@ -51,14 +52,14 @@ public async Task persist_and_load_subclass_with_abstract_parent() session.Store(activity); await session.SaveChangesAsync(); - session.Load(activity.Id).ShouldBeTheSameAs(activity); - session.Load(activity.Id).ShouldBeTheSameAs(activity); + session.Load(activity.Id).ShouldBeSameAs(activity); + session.Load(activity.Id).ShouldBeSameAs(activity); } using (var session = theStore.QuerySession()) { - session.Load(activity.Id).ShouldNotBeTheSameAs(activity).ShouldNotBeNull(); - session.Load(activity.Id).ShouldNotBeTheSameAs(activity).ShouldNotBeNull(); + session.Load(activity.Id).ShouldNotBeNull().ShouldNotBeSameAs(activity); + session.Load(activity.Id).ShouldNotBeNull().ShouldNotBeSameAs(activity); } } } diff --git a/src/LinqTests/Bugs/Bug_3030_nested_array_queries.cs b/src/LinqTests/Bugs/Bug_3030_nested_array_queries.cs index 1c221e90ac..0797b40b92 100644 --- a/src/LinqTests/Bugs/Bug_3030_nested_array_queries.cs +++ b/src/LinqTests/Bugs/Bug_3030_nested_array_queries.cs @@ -4,6 +4,7 @@ using System.Threading.Tasks; using Marten; using Marten.Testing.Harness; +using Shouldly; using Xunit.Abstractions; namespace LinqTests.Bugs; diff --git a/src/LinqTests/Bugs/Bug_3067_nested_array_in_dictionary.cs b/src/LinqTests/Bugs/Bug_3067_nested_array_in_dictionary.cs index 08f5ef70ef..de12398401 100644 --- a/src/LinqTests/Bugs/Bug_3067_nested_array_in_dictionary.cs +++ b/src/LinqTests/Bugs/Bug_3067_nested_array_in_dictionary.cs @@ -42,7 +42,7 @@ public async Task filter_with_dict_list_nested() .ToListAsync(); }); - ex.Message.ShouldContain("#>", StringComparisonOption.Default); + ex.Message.ShouldContain("#>"); } [Fact] diff --git a/src/LinqTests/Bugs/Bug_490_hierarchy_and_include.cs b/src/LinqTests/Bugs/Bug_490_hierarchy_and_include.cs index 110e5cced2..97776b7dda 100644 --- a/src/LinqTests/Bugs/Bug_490_hierarchy_and_include.cs +++ b/src/LinqTests/Bugs/Bug_490_hierarchy_and_include.cs @@ -72,7 +72,8 @@ public async Task load_abstract_type_with_include() session.Query() .Include(a => a.AccountId, accounts) .ToList() - .ShouldNotBeTheSameAs(activity).ShouldNotBeNull(); + .ShouldNotBeNull() + .ShouldNotBeSameAs(activity); accounts.First().Id.ShouldBe(1); } @@ -105,7 +106,8 @@ public async Task load_abstract_type_with_include_async() (await session.Query() .Include(a => a.AccountId, accounts) .ToListAsync()) - .ShouldNotBeTheSameAs(activity).ShouldNotBeNull(); + .ShouldNotBeNull() + .ShouldNotBeSameAs(activity); accounts.First().Id.ShouldBe(1); } diff --git a/src/LinqTests/Bugs/Bug_634_include_against_soft_deleted_docs.cs b/src/LinqTests/Bugs/Bug_634_include_against_soft_deleted_docs.cs index 3821b9cf58..fdef440936 100644 --- a/src/LinqTests/Bugs/Bug_634_include_against_soft_deleted_docs.cs +++ b/src/LinqTests/Bugs/Bug_634_include_against_soft_deleted_docs.cs @@ -3,6 +3,7 @@ using System.Threading.Tasks; using Marten.Testing.Documents; using Marten.Testing.Harness; +using Shouldly; using Xunit.Abstractions; namespace LinqTests.Bugs; diff --git a/src/LinqTests/Bugs/compiled_query_problem_with_nested_properties.cs b/src/LinqTests/Bugs/compiled_query_problem_with_nested_properties.cs index b1eaad962d..4f4b7056c1 100644 --- a/src/LinqTests/Bugs/compiled_query_problem_with_nested_properties.cs +++ b/src/LinqTests/Bugs/compiled_query_problem_with_nested_properties.cs @@ -5,6 +5,7 @@ using Marten.Linq; using Marten.Testing.Documents; using Marten.Testing.Harness; +using Shouldly; namespace LinqTests.Bugs; @@ -35,4 +36,4 @@ Expression, IEnumerable>> ICompiledQuery() + var res = await theSession.Query
() .Where(x => x.CategoryList.Any(s => interests.Contains(s))) .OrderBy(x => x.Long) - .ToList(); + .ToListAsync(); res.Count.ShouldBe(2); res[0].Long.ShouldBe(1); @@ -363,15 +363,15 @@ public void query_string_list_intersects_array() } [Fact] - public void query_nested_string_array_intersects_array() + public async Task query_nested_string_array_intersects_array() { - buildAuthorData(); + await buildAuthorData(); var interests = new[] { "nested" }; - var res = theSession.Query
() + var res = await theSession.Query
() .Where(x => x.ReferencedArticle.CategoryArray.Any(s => interests.Contains(s))) .OrderBy(x => x.Long) - .ToList(); + .ToListAsync(); res.Count.ShouldBe(1); res[0].Long.ShouldBe(6); @@ -394,14 +394,14 @@ public async Task query_string_array_intersects_array_with_boolean_and() } [Fact] - public void query_guid_array_intersects_array() + public async Task query_guid_array_intersects_array() { - buildAuthorData(); + await buildAuthorData(); - var res = theSession.Query
() + var res = await theSession.Query
() .Where(x => x.AuthorArray.Any(s => favAuthors.Contains(s))) .OrderBy(x => x.Long) - .ToList(); + .ToListAsync(); res.Count.ShouldBe(4); res[0].Long.ShouldBe(1); diff --git a/src/LinqTests/Compiled/compiled_queries.cs b/src/LinqTests/Compiled/compiled_queries.cs index 0375aaeb08..309d1f7ac1 100644 --- a/src/LinqTests/Compiled/compiled_queries.cs +++ b/src/LinqTests/Compiled/compiled_queries.cs @@ -85,7 +85,7 @@ public void can_explain_the_plan_for_a_compiled_query() var plan = theStore.Diagnostics.ExplainPlan(query); - SpecificationExtensions.ShouldNotBeNull(plan); + plan.ShouldNotBeNull(); } [Theory] @@ -104,7 +104,7 @@ public void a_single_item_compiled_query(DocumentTracking tracking) public void a_single_item_compiled_query_with_fields() { var user = theSession.Query(new UserByUsernameWithFields { UserName = "myusername" }); - SpecificationExtensions.ShouldNotBeNull(user); + user.ShouldNotBeNull(); var differentUser = theSession.Query(new UserByUsernameWithFields { UserName = "jdm" }); differentUser.UserName.ShouldBe("jdm"); } @@ -133,13 +133,13 @@ public void several_parameters_for_compiled_query() { Username = "jdm", FirstName = "Jeremy", LastName = "Miller" }); - SpecificationExtensions.ShouldNotBeNull(user); + user.ShouldNotBeNull(); user.UserName.ShouldBe("jdm"); user = theSession.Query(new FindUserByAllTheThings { Username = "shadetreedev", FirstName = "Jeremy", LastName = "Miller" }); - SpecificationExtensions.ShouldNotBeNull(user); + user.ShouldNotBeNull(); user.UserName.ShouldBe("shadetreedev"); } @@ -147,7 +147,7 @@ public void several_parameters_for_compiled_query() public async Task a_single_item_compiled_query_async() { var user = await theSession.QueryAsync(new UserByUsername { UserName = "myusername" }); - SpecificationExtensions.ShouldNotBeNull(user); + user.ShouldNotBeNull(); var differentUser = await theSession.QueryAsync(new UserByUsername { UserName = "jdm" }); differentUser.UserName.ShouldBe("jdm"); } @@ -299,8 +299,8 @@ public async Task bug_1090_Any_with_compiled_queries() { // Really just a smoke test now - (await theSession.QueryAsync(new CompiledQuery1 { StringValue = "foo" })).ShouldNotBeNull(); - (await theSession.QueryAsync(new CompiledQuery2())).ShouldNotBeNull(); + await theSession.QueryAsync(new CompiledQuery1 { StringValue = "foo" }); + await theSession.QueryAsync(new CompiledQuery2()); } [Fact] diff --git a/src/LinqTests/Includes/end_to_end_query_with_compiled_include.cs b/src/LinqTests/Includes/end_to_end_query_with_compiled_include.cs index 3dfff6a825..dcfa6ac777 100644 --- a/src/LinqTests/Includes/end_to_end_query_with_compiled_include.cs +++ b/src/LinqTests/Includes/end_to_end_query_with_compiled_include.cs @@ -32,10 +32,10 @@ public async Task simple_compiled_include_for_a_single_document() var issueQuery = new IssueByTitleWithAssignee { Title = issue.Title }; var issue2 = query.Query(issueQuery); - SpecificationExtensions.ShouldNotBeNull(issueQuery.Included); + issueQuery.Included.ShouldNotBeNull(); issueQuery.Included.Single().Id.ShouldBe(user.Id); - SpecificationExtensions.ShouldNotBeNull(issue2); + issue2.ShouldNotBeNull(); } public class IssueByTitleWithAssignee: ICompiledQuery diff --git a/src/LinqTests/Includes/end_to_end_query_with_include.cs b/src/LinqTests/Includes/end_to_end_query_with_include.cs index 3a7348019d..61861345c5 100644 --- a/src/LinqTests/Includes/end_to_end_query_with_include.cs +++ b/src/LinqTests/Includes/end_to_end_query_with_include.cs @@ -149,10 +149,10 @@ public async Task include_with_containment_where_for_a_single_document_with_came .Where(x => x.Tags.Contains("DIY")) .Single(); - SpecificationExtensions.ShouldNotBeNull(included); + included.ShouldNotBeNull(); included.Id.ShouldBe(user.Id); - SpecificationExtensions.ShouldNotBeNull(issue2); + issue2.ShouldNotBeNull(); } [Fact] @@ -172,10 +172,10 @@ public async Task include_with_any_containment_where_for_a_single_document() .Include(x => x.AssigneeId, x => included = x) .Single(x => x.Tags.Any(t => t == "DIY")); - SpecificationExtensions.ShouldNotBeNull(included); + included.ShouldNotBeNull(); included.Id.ShouldBe(user.Id); - SpecificationExtensions.ShouldNotBeNull(issue2); + issue2.ShouldNotBeNull(); } [Fact] @@ -197,10 +197,10 @@ public async Task include_with_any_containment_where_for_a_single_document_with_ .Where(x => x.Tags.Any(t => t == "DIY")) .Single(); - SpecificationExtensions.ShouldNotBeNull(included); + included.ShouldNotBeNull(); included.Id.ShouldBe(user.Id); - SpecificationExtensions.ShouldNotBeNull(issue2); + issue2.ShouldNotBeNull(); } [Fact] diff --git a/src/LinqTests/Operators/first_operator.cs b/src/LinqTests/Operators/first_operator.cs index 2b4ae1a369..c42c8464c7 100644 --- a/src/LinqTests/Operators/first_operator.cs +++ b/src/LinqTests/Operators/first_operator.cs @@ -25,7 +25,7 @@ public async Task first_hit_with_only_one_document() theSession.Store(new Target { Number = 4 }); await theSession.SaveChangesAsync(); - SpecificationExtensions.ShouldNotBeNull(theSession.Query().First(x => x.Number == 3)); + theSession.Query().First(x => x.Number == 3).ShouldNotBeNull(); } [Fact] @@ -105,7 +105,7 @@ public async Task first_hit_with_only_one_document_async() await theSession.SaveChangesAsync(); var target = await theSession.Query().FirstAsync(x => x.Number == 3); - SpecificationExtensions.ShouldNotBeNull(target); + target.ShouldNotBeNull(); } [Fact] @@ -118,7 +118,7 @@ public async Task first_or_default_hit_with_only_one_document_async() await theSession.SaveChangesAsync(); var target = await theSession.Query().FirstOrDefaultAsync(x => x.Number == 3); - SpecificationExtensions.ShouldNotBeNull(target); + target.ShouldNotBeNull(); } [Fact] @@ -131,7 +131,7 @@ public async Task first_or_default_miss_async() await theSession.SaveChangesAsync(); var target = await theSession.Query().FirstOrDefaultAsync(x => x.Number == 11); - SpecificationExtensions.ShouldBeNull(target); + target.ShouldBeNull(); } [Fact] diff --git a/src/LinqTests/Operators/last_operator.cs b/src/LinqTests/Operators/last_operator.cs index f0d75d7699..4a20c07874 100644 --- a/src/LinqTests/Operators/last_operator.cs +++ b/src/LinqTests/Operators/last_operator.cs @@ -20,7 +20,7 @@ public async Task last_throws_an_exception() Should.Throw(() => { - SpecificationExtensions.ShouldNotBeNull(theSession.Query().Last(x => x.Number == 3)); + theSession.Query().Last(x => x.Number == 3).ShouldNotBeNull(); }); } @@ -35,7 +35,7 @@ public async Task last_or_default_throws_an_exception() Should.Throw(() => { - SpecificationExtensions.ShouldNotBeNull(theSession.Query().Last(x => x.Number == 3)); + theSession.Query().Last(x => x.Number == 3).ShouldNotBeNull(); }); } diff --git a/src/LinqTests/Operators/single_operator.cs b/src/LinqTests/Operators/single_operator.cs index e141c870d3..87b0225928 100644 --- a/src/LinqTests/Operators/single_operator.cs +++ b/src/LinqTests/Operators/single_operator.cs @@ -23,7 +23,7 @@ public async Task single_hit_with_only_one_document() theSession.Store(new Target{Number = 4}); await theSession.SaveChangesAsync(); - SpecificationExtensions.ShouldNotBeNull(theSession.Query().Single(x => x.Number == 3)); + theSession.Query().Single(x => x.Number == 3).ShouldNotBeNull(); } [Fact] @@ -35,7 +35,7 @@ public async Task single_or_default_hit_with_only_one_document() theSession.Store(new Target { Number = 4 }); await theSession.SaveChangesAsync(); - SpecificationExtensions.ShouldNotBeNull(theSession.Query().SingleOrDefault(x => x.Number == 3)); + theSession.Query().SingleOrDefault(x => x.Number == 3).ShouldNotBeNull(); } #endregion @@ -48,7 +48,7 @@ public async Task single_or_default_miss() theSession.Store(new Target { Number = 4 }); await theSession.SaveChangesAsync(); - SpecificationExtensions.ShouldBeNull(theSession.Query().SingleOrDefault(x => x.Number == 11)); + theSession.Query().SingleOrDefault(x => x.Number == 11).ShouldBeNull(); } [Fact] diff --git a/src/LinqTests/using_containment_operator_in_linq_Tests.cs b/src/LinqTests/using_containment_operator_in_linq_Tests.cs index a3bb2a77f3..851a8cdf3d 100644 --- a/src/LinqTests/using_containment_operator_in_linq_Tests.cs +++ b/src/LinqTests/using_containment_operator_in_linq_Tests.cs @@ -27,8 +27,7 @@ public async Task query_by_date() var actual = session.Query().Where(x => x.Date == targets.ElementAt(2).Date) .ToArray(); - SpecificationExtensions.ShouldBeGreaterThan(actual.Length, 0); - + actual.Length.ShouldBeGreaterThan(0); actual.ShouldContain(targets.ElementAt(2)); } @@ -91,7 +90,7 @@ public async Task query_by_date() var actual = session.Query().Where(x => x.Date == targets.ElementAt(2).Date) .ToArray(); - SpecificationExtensions.ShouldBeGreaterThan(actual.Length, 0); + actual.Length.ShouldBeGreaterThan(0); actual.ShouldContain(targets.ElementAt(2)); } diff --git a/src/Marten.PLv8.Testing/Patching/PatchExpressionTests.cs b/src/Marten.PLv8.Testing/Patching/PatchExpressionTests.cs index 45ba73e829..ac9c0750f5 100644 --- a/src/Marten.PLv8.Testing/Patching/PatchExpressionTests.cs +++ b/src/Marten.PLv8.Testing/Patching/PatchExpressionTests.cs @@ -435,8 +435,8 @@ public void duplicate_property_to_multiple_targets() [Fact] public void duplicate_property_no_target() { - SpecificationExtensions.ShouldContain(Assert.Throws(() => _expression.Duplicate(x => x.String)) - .Message, "At least one destination must be given"); + var ex = Should.Throw(() => _expression.Duplicate(x => x.String)); + ex.Message.ShouldContain("At least one destination must be given"); } [Fact] diff --git a/src/Marten.PLv8.Testing/Patching/patching_api.cs b/src/Marten.PLv8.Testing/Patching/patching_api.cs index ae96584f41..4e5410dcc6 100644 --- a/src/Marten.PLv8.Testing/Patching/patching_api.cs +++ b/src/Marten.PLv8.Testing/Patching/patching_api.cs @@ -189,7 +189,7 @@ public async Task duplicate_to_multiple_new_fields() var result = query.Load(target.Id); result.StringField.ShouldBe(target.String); - SpecificationExtensions.ShouldNotBeNull(result.Inner); + result.Inner.ShouldNotBeNull(); result.Inner.String.ShouldBe(target.String); result.Inner.AnotherString.ShouldBe(target.String); } @@ -582,7 +582,7 @@ public async Task rename_shallow_prop() { var target2 = query.Load(target.Id); target2.AnotherString.ShouldBe("Foo"); - SpecificationExtensions.ShouldBeNull(target2.String); + target2.String.ShouldBeNull(); } } @@ -604,7 +604,7 @@ public async Task rename_deep_prop() { var target2 = query.Load(target.Id); target2.Inner.AnotherString.ShouldBe("Foo"); - SpecificationExtensions.ShouldBeNull(target2.Inner.String); + target2.Inner.String.ShouldBeNull(); } } @@ -721,7 +721,7 @@ public async Task delete_redundant_property() { var result = query.Load(target.Id); - SpecificationExtensions.ShouldBeNull(result.String); + result.String.ShouldBeNull(); } } @@ -741,7 +741,7 @@ public async Task delete_redundant_nested_property() { var result = query.Load(target.Id); - SpecificationExtensions.ShouldBeNull(result.Inner.String); + result.Inner.String.ShouldBeNull(); } } @@ -761,7 +761,7 @@ public async Task delete_existing_property() { var result = query.Load(target.Id); - SpecificationExtensions.ShouldBeNull(result.Inner); + result.Inner.ShouldBeNull(); } } diff --git a/src/Marten.PLv8.Testing/Transforms/TransformFunctionTests.cs b/src/Marten.PLv8.Testing/Transforms/TransformFunctionTests.cs index f11d15f72c..ef56a3dd5d 100644 --- a/src/Marten.PLv8.Testing/Transforms/TransformFunctionTests.cs +++ b/src/Marten.PLv8.Testing/Transforms/TransformFunctionTests.cs @@ -48,7 +48,7 @@ public async Task writes_transform_function() var lines = File.ReadAllText(file); lines.ShouldContain( - "CREATE OR REPLACE FUNCTION public.mt_transform_get_fullname(doc JSONB) RETURNS JSONB AS $$", Case.Insensitive); + "CREATE OR REPLACE FUNCTION public.mt_transform_get_fullname(doc JSONB) RETURNS JSONB AS $$"); } @@ -95,7 +95,7 @@ public void create_function_for_file() func.Name.ShouldBe("get_fullname"); - SpecificationExtensions.ShouldContain(func.Body, "module.exports"); + func.Body.ShouldContain("module.exports"); func.Identifier.Name.ShouldBe("mt_transform_get_fullname"); } @@ -108,7 +108,7 @@ public void create_function_for_resource() func.Name.ShouldBe("get_fullname"); - SpecificationExtensions.ShouldContain(func.Body, "module.exports"); + func.Body.ShouldContain("module.exports"); func.Identifier.Name.ShouldBe("mt_transform_get_fullname"); } diff --git a/src/Marten.Testing/Examples/IdentityMapTests.cs b/src/Marten.Testing/Examples/IdentityMapTests.cs index 8d8d01a92a..aa8eaa7795 100644 --- a/src/Marten.Testing/Examples/IdentityMapTests.cs +++ b/src/Marten.Testing/Examples/IdentityMapTests.cs @@ -1,5 +1,6 @@ using Marten.Testing.Documents; using Marten.Testing.Harness; +using Shouldly; namespace Marten.Testing.Examples; @@ -14,7 +15,7 @@ public void using_identity_map() // Open a document session with the identity map using var session = theStore.IdentitySession(); session.Load(user.Id) - .ShouldBeTheSameAs(session.Load(user.Id)); + .ShouldBeSameAs(session.Load(user.Id)); #endregion } diff --git a/src/Marten.Testing/Examples/Setting_Timestamp_on_all_changes_by_base_class_Tests.cs b/src/Marten.Testing/Examples/Setting_Timestamp_on_all_changes_by_base_class_Tests.cs index 5d1d4d0045..13e4114242 100644 --- a/src/Marten.Testing/Examples/Setting_Timestamp_on_all_changes_by_base_class_Tests.cs +++ b/src/Marten.Testing/Examples/Setting_Timestamp_on_all_changes_by_base_class_Tests.cs @@ -3,6 +3,7 @@ using System.Threading.Tasks; using JasperFx.Core; using Marten.Testing.Harness; +using Shouldly; using Weasel.Core; using Weasel.Postgresql; using Xunit; diff --git a/src/Marten.Testing/Harness/SpecificationExtensions.cs b/src/Marten.Testing/Harness/SpecificationExtensions.cs index 870a3c1da6..bf91ee87e6 100644 --- a/src/Marten.Testing/Harness/SpecificationExtensions.cs +++ b/src/Marten.Testing/Harness/SpecificationExtensions.cs @@ -14,8 +14,6 @@ namespace Marten.Testing.Harness { - public delegate void MethodThatThrows(); - public static class SpecificationExtensions { public static void ShouldBeSemanticallySameJsonAs(this string json, string expectedJson) @@ -26,13 +24,6 @@ public static void ShouldBeSemanticallySameJsonAs(this string json, string expec JToken.DeepEquals(expected, actual).ShouldBeTrue($"Expected:\n{expectedJson}\nGot:\n{json}"); } - - public static void ShouldContain(this IEnumerable actual, Func expected) - { - actual.Count().ShouldBeGreaterThan(0); - actual.Any(expected).ShouldBeTrue(); - } - public static void ShouldHaveTheSameElementsAs(this IEnumerable actual, IEnumerable expected) { var actualList = (actual is IList tempActual) ? tempActual : actual.ToList(); @@ -74,110 +65,6 @@ public static void ShouldHaveTheSameElementsAs(this IList actual, IList expected } } - public static void ShouldBeNull(this object anObject) - { - anObject.ShouldBe(null); - } - - public static void ShouldNotBeNull(this object anObject) - { - anObject.ShouldNotBe(null); - } - - public static object ShouldBeTheSameAs(this object actual, object expected) - { - ReferenceEquals(actual, expected).ShouldBeTrue(); - return expected; - } - - public static T IsType(this object actual) - { - actual.ShouldBeOfType(typeof(T)); - return (T)actual; - } - - public static object ShouldNotBeTheSameAs(this object actual, object expected) - { - ReferenceEquals(actual, expected).ShouldBeFalse(); - return expected; - } - - public static void ShouldNotBeOfType(this object actual) - { - actual.ShouldNotBeOfType(typeof(T)); - } - - public static void ShouldNotBeOfType(this object actual, Type expected) - { - actual.GetType().ShouldNotBe(expected); - } - - public static IComparable ShouldBeGreaterThan(this IComparable arg1, IComparable arg2) - { - (arg1.CompareTo(arg2) > 0).ShouldBeTrue(); - - return arg2; - } - - public static string ShouldNotBeEmpty(this string aString) - { - aString.IsNotEmpty().ShouldBeTrue(); - - return aString; - } - - public static void ShouldContain(this string actual, string expected, StringComparisonOption options = StringComparisonOption.Default) - { - if (options == StringComparisonOption.NormalizeWhitespaces) - { - actual = Regex.Replace(actual, @"\s+", " "); - expected = Regex.Replace(expected, @"\s+", " "); - } - actual.Contains(expected).ShouldBeTrue($"Actual: {actual}{Environment.NewLine}Expected: {expected}"); - } - - public static string ShouldNotContain(this string actual, string expected, StringComparisonOption options = StringComparisonOption.NormalizeWhitespaces) - { - if (options == StringComparisonOption.NormalizeWhitespaces) - { - actual = Regex.Replace(actual, @"\s+", " "); - expected = Regex.Replace(expected, @"\s+", " "); - } - actual.Contains(expected).ShouldBeFalse($"Actual: {actual}{Environment.NewLine}Expected: {expected}"); - return actual; - } - - public static void ShouldStartWith(this string actual, string expected) - { - actual.StartsWith(expected).ShouldBeTrue(); - } - - public static Exception ShouldBeThrownBy(this Type exceptionType, MethodThatThrows method) - { - Exception exception = null; - - try - { - method(); - } - catch (Exception e) - { - e.GetType().ShouldBe(exceptionType); - exception = e; - } - - exception.ShouldNotBeNull("Expected {0} to be thrown.".ToFormat(exceptionType.FullName)); - - return exception; - } - - public static void ShouldBeEqualWithDbPrecision(this DateTime actual, DateTime expected) - { - static DateTime toDbPrecision(DateTime date) => new DateTime(date.Ticks / 1000 * 1000); - - toDbPrecision(actual).ShouldBe(toDbPrecision(expected)); - } - public static void ShouldBeEqualWithDbPrecision(this DateTimeOffset actual, DateTimeOffset expected) { static DateTimeOffset toDbPrecision(DateTimeOffset date) => new DateTimeOffset(date.Ticks / 1000 * 1000, new TimeSpan(date.Offset.Ticks / 1000 * 1000)); @@ -195,9 +82,4 @@ public static void ShouldContain(this DbObjectName[] names, string qualifiedName } } - public enum StringComparisonOption - { - Default, - NormalizeWhitespaces - } } diff --git a/src/Marten.Testing/Marten.Testing.csproj b/src/Marten.Testing/Marten.Testing.csproj index a5a48802ef..409c8faac7 100644 --- a/src/Marten.Testing/Marten.Testing.csproj +++ b/src/Marten.Testing/Marten.Testing.csproj @@ -21,6 +21,7 @@ + diff --git a/src/CoreTests/MartenHostEnvironment.cs b/src/Marten.Testing/MartenHostEnvironment.cs similarity index 96% rename from src/CoreTests/MartenHostEnvironment.cs rename to src/Marten.Testing/MartenHostEnvironment.cs index 9cacf06120..7908d8d84e 100644 --- a/src/CoreTests/MartenHostEnvironment.cs +++ b/src/Marten.Testing/MartenHostEnvironment.cs @@ -3,7 +3,7 @@ using Microsoft.Extensions.FileProviders; using Microsoft.Extensions.Hosting; -namespace CoreTests; +namespace Marten.Testing; internal class MartenHostEnvironment : IHostEnvironment { diff --git a/src/Marten.Testing/RecordingLogger.cs b/src/Marten.Testing/RecordingLogger.cs new file mode 100644 index 0000000000..cdf85aac3f --- /dev/null +++ b/src/Marten.Testing/RecordingLogger.cs @@ -0,0 +1,62 @@ +using System; +using System.Collections.Generic; +using Marten.Services; +using Npgsql; + +namespace Marten.Testing; + +public class RecordingLogger: IMartenSessionLogger +{ + public NpgsqlCommand LastCommand; + public Exception LastException; + public readonly IList Commits = new List(); + public IChangeSet LastCommit { get; set; } + + public IDocumentSession LastSession { get; set; } + + public int OnBeforeExecuted { get; set; } + + public void LogFailure(NpgsqlBatch batch, Exception ex) + { + + } + + public void LogFailure(Exception ex, string message) + { + + } + + public void RecordSavedChanges(IDocumentSession session, IChangeSet commit) + { + LastSession = session; + LastCommit = commit.Clone(); + + Commits.Add(commit); + } + + public void OnBeforeExecute(NpgsqlCommand command) + { + OnBeforeExecuted++; + } + + public void OnBeforeExecute(NpgsqlBatch batch) + { + + } + + public void LogSuccess(NpgsqlCommand command) + { + LastCommand = command; + } + + public void LogFailure(NpgsqlCommand command, Exception ex) + { + LastCommand = command; + LastException = ex; + } + + public void LogSuccess(NpgsqlBatch batch) + { + + } +} diff --git a/src/MultiTenancyTests/SingleServerMultiTenancyTests.cs b/src/MultiTenancyTests/SingleServerMultiTenancyTests.cs index 5a4abf7e06..a5e3531c87 100644 --- a/src/MultiTenancyTests/SingleServerMultiTenancyTests.cs +++ b/src/MultiTenancyTests/SingleServerMultiTenancyTests.cs @@ -88,7 +88,7 @@ public async Task build_database_on_the_fly() var database2 = await theTenancy.FindOrCreateDatabase("tenant1"); - database.ShouldBeTheSameAs(database); + database.ShouldBeSameAs(database); } [Fact] @@ -108,7 +108,7 @@ public async Task build_tenant_where_database_is_already_built() var database = await theTenancy.FindOrCreateDatabase("tenant1"); (await DatabaseExists("tenant1")).ShouldBeTrue(); var tenant = theTenancy.GetTenant("tenant1"); - tenant.Database.ShouldBeTheSameAs(database); + tenant.Database.ShouldBeSameAs(database); tenant.TenantId.ShouldBe("tenant1"); } @@ -119,7 +119,7 @@ public async Task build_tenant_where_database_does_not_already_exist() var tenant = theTenancy.GetTenant("tenant1"); (await DatabaseExists("tenant1")).ShouldBeTrue(); var database = await theTenancy.FindOrCreateDatabase("tenant1"); - tenant.Database.ShouldBeTheSameAs(database); + tenant.Database.ShouldBeSameAs(database); tenant.TenantId.ShouldBe("tenant1"); } @@ -130,7 +130,7 @@ public async Task build_tenant_where_database_is_already_built_async() var database = await theTenancy.FindOrCreateDatabase("tenant1"); (await DatabaseExists("tenant1")).ShouldBeTrue(); var tenant = await theTenancy.GetTenantAsync("tenant1"); - tenant.Database.ShouldBeTheSameAs(database); + tenant.Database.ShouldBeSameAs(database); tenant.TenantId.ShouldBe("tenant1"); } @@ -141,7 +141,7 @@ public async Task build_tenant_where_database_does_not_already_exist_async() var tenant = await theTenancy.GetTenantAsync("tenant1"); (await DatabaseExists("tenant1")).ShouldBeTrue(); var database = await theTenancy.FindOrCreateDatabase("tenant1"); - tenant.Database.ShouldBeTheSameAs(database); + tenant.Database.ShouldBeSameAs(database); tenant.TenantId.ShouldBe("tenant1"); } @@ -156,9 +156,9 @@ public async Task seed_tenant_id_and_build_in_advance() databases.Select(x => x.Identifier).ShouldHaveTheSameElementsAs("tenant1", "tenant2", "tenant3"); - databases[0].ShouldBeTheSameAs(await theTenancy.FindOrCreateDatabase("tenant1")); - databases[1].ShouldBeTheSameAs(await theTenancy.FindOrCreateDatabase("tenant2")); - databases[2].ShouldBeTheSameAs(await theTenancy.FindOrCreateDatabase("tenant3")); + databases[0].ShouldBeSameAs(await theTenancy.FindOrCreateDatabase("tenant1")); + databases[1].ShouldBeSameAs(await theTenancy.FindOrCreateDatabase("tenant2")); + databases[2].ShouldBeSameAs(await theTenancy.FindOrCreateDatabase("tenant3")); } [Fact] @@ -175,8 +175,8 @@ public async Task seed_tenant_id_and_build_in_advance_with_database_mappings() databases.Select(x => x.Identifier).ShouldHaveTheSameElementsAs("database1", "database2"); - databases[0].ShouldBeTheSameAs(await theTenancy.FindOrCreateDatabase("database1")); - databases[1].ShouldBeTheSameAs(await theTenancy.FindOrCreateDatabase("database2")); + databases[0].ShouldBeSameAs(await theTenancy.FindOrCreateDatabase("database1")); + databases[1].ShouldBeSameAs(await theTenancy.FindOrCreateDatabase("database2")); } [Fact] diff --git a/src/PatchingTests/Patching/PatchExpressionTests.cs b/src/PatchingTests/Patching/PatchExpressionTests.cs index 052cfc2745..927a2e038f 100644 --- a/src/PatchingTests/Patching/PatchExpressionTests.cs +++ b/src/PatchingTests/Patching/PatchExpressionTests.cs @@ -452,8 +452,8 @@ public void duplicate_property_to_multiple_targets() [Fact] public void duplicate_property_no_target() { - SpecificationExtensions.ShouldContain(Assert.Throws(() => _expression.Duplicate(x => x.String)) - .Message, "At least one destination must be given"); + var ex = Should.Throw(() => _expression.Duplicate(x => x.String)); + ex.Message.ShouldContain("At least one destination must be given"); } [Fact] diff --git a/src/PatchingTests/Patching/patching_api.cs b/src/PatchingTests/Patching/patching_api.cs index 0018c419f8..5e034629a8 100644 --- a/src/PatchingTests/Patching/patching_api.cs +++ b/src/PatchingTests/Patching/patching_api.cs @@ -163,7 +163,7 @@ public async Task duplicate_to_multiple_new_fields() var result = query.Load(target.Id); result.StringField.ShouldBe(target.String); - SpecificationExtensions.ShouldNotBeNull(result.Inner); + result.Inner.ShouldNotBeNull(); result.Inner.String.ShouldBe(target.String); result.Inner.AnotherString.ShouldBe(target.String); } @@ -573,7 +573,7 @@ public async Task rename_shallow_prop() { var target2 = query.Load(target.Id); target2.AnotherString.ShouldBe("Foo"); - SpecificationExtensions.ShouldBeNull(target2.String); + target2.String.ShouldBeNull(); } } @@ -595,7 +595,7 @@ public async Task rename_deep_prop() { var target2 = query.Load(target.Id); target2.Inner.AnotherString.ShouldBe("Foo"); - SpecificationExtensions.ShouldBeNull(target2.Inner.String); + target2.Inner.String.ShouldBeNull(); } } @@ -713,7 +713,7 @@ public async Task delete_redundant_property() { var result = query.Load(target.Id); - SpecificationExtensions.ShouldBeNull(result.String); + result.String.ShouldBeNull(); } } @@ -733,7 +733,7 @@ public async Task delete_redundant_nested_property() { var result = query.Load(target.Id); - SpecificationExtensions.ShouldBeNull(result.Inner.String); + result.Inner.String.ShouldBeNull(); } } @@ -753,7 +753,7 @@ public async Task delete_existing_property() { var result = query.Load(target.Id); - SpecificationExtensions.ShouldBeNull(result.Inner); + result.Inner.ShouldBeNull(); } } diff --git a/src/EventSourcingTests/Bugs/Bug_3113_do_not_reorder_sql_operations.cs b/src/StressTests/Bugs/Bug_3113_do_not_reorder_sql_operations.cs similarity index 99% rename from src/EventSourcingTests/Bugs/Bug_3113_do_not_reorder_sql_operations.cs rename to src/StressTests/Bugs/Bug_3113_do_not_reorder_sql_operations.cs index a57f1d3725..e21aad95d8 100644 --- a/src/EventSourcingTests/Bugs/Bug_3113_do_not_reorder_sql_operations.cs +++ b/src/StressTests/Bugs/Bug_3113_do_not_reorder_sql_operations.cs @@ -1,7 +1,3 @@ -using Marten.Schema; - -namespace EventSourcingTests.Bugs; - using System; using System.Collections.Generic; using System.Linq; @@ -9,11 +5,14 @@ namespace EventSourcingTests.Bugs; using Marten; using Marten.Events; using Marten.Events.Projections; +using Marten.Schema; using Marten.Testing.Harness; using Shouldly; using Weasel.Postgresql.Tables; using Xunit; +namespace StressTests.Bugs; + public sealed class Bug_3113_do_not_reorder_sql_operations : BugIntegrationContext { [Fact] diff --git a/src/CoreTests/Bugs/Bug_616_not_possible_to_use_Serializable_transactions.cs b/src/StressTests/Bugs/Bug_616_not_possible_to_use_Serializable_transactions.cs similarity index 98% rename from src/CoreTests/Bugs/Bug_616_not_possible_to_use_Serializable_transactions.cs rename to src/StressTests/Bugs/Bug_616_not_possible_to_use_Serializable_transactions.cs index f957efc083..e93199e841 100644 --- a/src/CoreTests/Bugs/Bug_616_not_possible_to_use_Serializable_transactions.cs +++ b/src/StressTests/Bugs/Bug_616_not_possible_to_use_Serializable_transactions.cs @@ -6,7 +6,7 @@ using Shouldly; using Xunit; -namespace CoreTests.Bugs; +namespace StressTests.Bugs; public class Bug616Account { diff --git a/src/StressTests/StressTests.csproj b/src/StressTests/StressTests.csproj index eaec47217c..525c12d98e 100644 --- a/src/StressTests/StressTests.csproj +++ b/src/StressTests/StressTests.csproj @@ -29,6 +29,15 @@ + + + MartenHostEnvironment.cs + + + RecordingLogger.cs + + + xUnit1013 diff --git a/src/CoreTests/using_multiple_document_stores_in_same_host.cs b/src/StressTests/using_multiple_document_stores_in_same_host.cs similarity index 97% rename from src/CoreTests/using_multiple_document_stores_in_same_host.cs rename to src/StressTests/using_multiple_document_stores_in_same_host.cs index df3bce0bd8..229ca3d8fb 100644 --- a/src/CoreTests/using_multiple_document_stores_in_same_host.cs +++ b/src/StressTests/using_multiple_document_stores_in_same_host.cs @@ -2,16 +2,16 @@ using System.IO; using System.Linq; using System.Threading.Tasks; -using JasperFx.Core; -using Lamar; using JasperFx.CodeGeneration; +using JasperFx.Core; using JasperFx.Core.Reflection; +using Lamar; using Marten; -using Marten.Events.Daemon; using Marten.Events.Daemon.Coordination; using Marten.Events.Daemon.Resiliency; using Marten.Internal; using Marten.Services; +using Marten.Testing; using Marten.Testing.Documents; using Marten.Testing.Harness; using Microsoft.Extensions.DependencyInjection; @@ -21,7 +21,7 @@ using Weasel.Core.Migrations; using Xunit; -namespace CoreTests; +namespace StressTests; public class using_multiple_document_stores_in_same_host : IDisposable { @@ -47,7 +47,7 @@ public using_multiple_document_stores_in_same_host() }); // Just to prove that this doesn't blow up, see GH-2892 - services.AddKeyedSingleton("blue", new StoreOptionsTests.RecordingLogger()); + services.AddKeyedSingleton("blue", new RecordingLogger()); services.AddMartenStore(services => { @@ -128,10 +128,14 @@ public void all_the_defaults() { using var container = Container.For(services => { - services.AddMarten(ConnectionSource.ConnectionString); + services.AddMarten(opts => + { + opts.Connection(ConnectionSource.ConnectionString); + }); services.AddMartenStore(opts => { + opts.ApplyChangesLockId += 17; opts.Connection(ConnectionSource.ConnectionString); opts.DatabaseSchemaName = "first_store"; }); @@ -370,8 +374,10 @@ public async Task apply_changes_on_startup() x.AddLogging(); x.AddMartenStore(opts => { + opts.ApplyChangesLockId += 19; opts.Connection(ConnectionSource.ConnectionString); opts.RegisterDocumentType(); + opts.DatabaseSchemaName = "first_store"; }) .ApplyAllDatabaseChangesOnStartup(); }); diff --git a/src/ValueTypeTests/StrongTypedId/fsharp_discriminated_union_document_operations.cs b/src/ValueTypeTests/StrongTypedId/fsharp_discriminated_union_document_operations.cs index 5fd0ac2265..027b612162 100644 --- a/src/ValueTypeTests/StrongTypedId/fsharp_discriminated_union_document_operations.cs +++ b/src/ValueTypeTests/StrongTypedId/fsharp_discriminated_union_document_operations.cs @@ -83,7 +83,7 @@ public void store_document_will_assign_the_identity() // Marten sees that there is no existing identity, // so it assigns a new identity - SpecificationExtensions.ShouldNotBeNull(order.Id); + order.Id.ShouldNotBeNull(); } [Fact] @@ -199,7 +199,7 @@ public async Task delete_by_id() theSession.Delete(order.Id); await theSession.SaveChangesAsync(); - SpecificationExtensions.ShouldBeNull((await theSession.LoadAsync(order.Id))); + (await theSession.LoadAsync(order.Id)).ShouldBeNull(); } [Fact] @@ -213,7 +213,7 @@ public async Task delete_by_document() theSession.Delete(order); await theSession.SaveChangesAsync(); - SpecificationExtensions.ShouldBeNull((await theSession.LoadAsync(order.Id))); + (await theSession.LoadAsync(order.Id)).ShouldBeNull(); } diff --git a/src/ValueTypeTests/StrongTypedId/guid_based_document_operations.cs b/src/ValueTypeTests/StrongTypedId/guid_based_document_operations.cs index 8494def661..f63e903761 100644 --- a/src/ValueTypeTests/StrongTypedId/guid_based_document_operations.cs +++ b/src/ValueTypeTests/StrongTypedId/guid_based_document_operations.cs @@ -22,7 +22,7 @@ public guid_id_document_operations() theStore = DocumentStore.For(opts => { opts.Connection(ConnectionSource.ConnectionString); - opts.DatabaseSchemaName = "strong_typed"; + opts.DatabaseSchemaName = "strong_typed1"; opts.ApplicationAssembly = GetType().Assembly; opts.GeneratedCodeMode = TypeLoadMode.Auto; @@ -309,7 +309,7 @@ public guid_id_document_operations_with_non_nullable_identifier() theStore = DocumentStore.For(opts => { opts.Connection(ConnectionSource.ConnectionString); - opts.DatabaseSchemaName = "strong_typed"; + opts.DatabaseSchemaName = "strong_typed21"; opts.ApplicationAssembly = GetType().Assembly; opts.GeneratedCodeMode = TypeLoadMode.Auto; @@ -344,7 +344,7 @@ public void store_document_will_assign_the_identity() // Marten sees that there is no existing identity, // so it assigns a new identity - invoice.Id.ShouldNotBeNull(); + invoice.Id.ShouldNotBe(default); invoice.Id.Value.ShouldNotBe(Guid.Empty); } diff --git a/src/ValueTypeTests/StrongTypedId/int_based_document_operations.cs b/src/ValueTypeTests/StrongTypedId/int_based_document_operations.cs index 67ec0d79f6..e30cbbd6d5 100644 --- a/src/ValueTypeTests/StrongTypedId/int_based_document_operations.cs +++ b/src/ValueTypeTests/StrongTypedId/int_based_document_operations.cs @@ -19,7 +19,7 @@ public int_based_document_operations() theStore = DocumentStore.For(opts => { opts.Connection(ConnectionSource.ConnectionString); - opts.DatabaseSchemaName = "strong_typed"; + opts.DatabaseSchemaName = "strong_typed2"; }); theSession = theStore.LightweightSession(); @@ -287,7 +287,7 @@ public int_based_document_operations_with_non_nullable_id() theStore = DocumentStore.For(opts => { opts.Connection(ConnectionSource.ConnectionString); - opts.DatabaseSchemaName = "strong_typed"; + opts.DatabaseSchemaName = "strong_typed20"; }); theSession = theStore.LightweightSession(); @@ -312,8 +312,8 @@ public void store_document_will_assign_the_identity() var order = new Order3(); theSession.Store(order); - order.Id.ShouldNotBeNull(); - ShouldBeTestExtensions.ShouldNotBe(order.Id.Value, 0); + order.Id.ShouldNotBe(default); + order.Id.Value.ShouldNotBe(0); } [Fact] diff --git a/src/ValueTypeTests/StrongTypedId/long_based_document_operations.cs b/src/ValueTypeTests/StrongTypedId/long_based_document_operations.cs index dcaefa0005..efe98f938c 100644 --- a/src/ValueTypeTests/StrongTypedId/long_based_document_operations.cs +++ b/src/ValueTypeTests/StrongTypedId/long_based_document_operations.cs @@ -19,7 +19,7 @@ public long_based_document_operations() theStore = DocumentStore.For(opts => { opts.Connection(ConnectionSource.ConnectionString); - opts.DatabaseSchemaName = "strong_typed"; + opts.DatabaseSchemaName = "strong_typed3"; }); theSession = theStore.LightweightSession(); @@ -290,7 +290,7 @@ public long_based_document_operations_with_non_nullable_id() theStore = DocumentStore.For(opts => { opts.Connection(ConnectionSource.ConnectionString); - opts.DatabaseSchemaName = "strong_typed"; + opts.DatabaseSchemaName = "strong_typed22"; }); theSession = theStore.LightweightSession(); @@ -316,7 +316,7 @@ public void store_document_will_assign_the_identity() theSession.Store(issue); - issue.Id.ShouldNotBeNull(); + issue.Id.ShouldNotBe(default); issue.Id.Value.ShouldNotBe(0); } diff --git a/src/ValueTypeTests/StrongTypedId/string_id_document_operations.cs b/src/ValueTypeTests/StrongTypedId/string_id_document_operations.cs index f1a8c1415a..1fd74b9e4a 100644 --- a/src/ValueTypeTests/StrongTypedId/string_id_document_operations.cs +++ b/src/ValueTypeTests/StrongTypedId/string_id_document_operations.cs @@ -21,7 +21,7 @@ public string_id_document_operations() theStore = DocumentStore.For(opts => { opts.Connection(ConnectionSource.ConnectionString); - opts.DatabaseSchemaName = "strong_typed"; + opts.DatabaseSchemaName = "strong_typed4"; opts.ApplicationAssembly = GetType().Assembly; opts.GeneratedCodeMode = TypeLoadMode.Auto; @@ -268,7 +268,7 @@ public string_id_document_operations_with_non_nullable_id() theStore = DocumentStore.For(opts => { opts.Connection(ConnectionSource.ConnectionString); - opts.DatabaseSchemaName = "strong_typed"; + opts.DatabaseSchemaName = "strong_typed23"; opts.ApplicationAssembly = GetType().Assembly; opts.GeneratedCodeMode = TypeLoadMode.Auto; diff --git a/src/ValueTypeTests/Vogen/guid_based_document_operations.cs b/src/ValueTypeTests/Vogen/guid_based_document_operations.cs index 905cd6965f..5c9fae4b25 100644 --- a/src/ValueTypeTests/Vogen/guid_based_document_operations.cs +++ b/src/ValueTypeTests/Vogen/guid_based_document_operations.cs @@ -20,7 +20,7 @@ public guid_id_document_operations() theStore = DocumentStore.For(opts => { opts.Connection(ConnectionSource.ConnectionString); - opts.DatabaseSchemaName = "strong_typed"; + opts.DatabaseSchemaName = "strong_typed5"; opts.ApplicationAssembly = GetType().Assembly; opts.GeneratedCodeMode = TypeLoadMode.Auto; diff --git a/src/ValueTypeTests/Vogen/int_based_document_operations.cs b/src/ValueTypeTests/Vogen/int_based_document_operations.cs index f3315eed4c..45bb02248a 100644 --- a/src/ValueTypeTests/Vogen/int_based_document_operations.cs +++ b/src/ValueTypeTests/Vogen/int_based_document_operations.cs @@ -18,7 +18,7 @@ public int_based_document_operations() theStore = DocumentStore.For(opts => { opts.Connection(ConnectionSource.ConnectionString); - opts.DatabaseSchemaName = "strong_typed"; + opts.DatabaseSchemaName = "strong_typed6"; }); theSession = theStore.LightweightSession(); diff --git a/src/ValueTypeTests/Vogen/long_based_document_operations.cs b/src/ValueTypeTests/Vogen/long_based_document_operations.cs index 842e462a0c..ab757566a0 100644 --- a/src/ValueTypeTests/Vogen/long_based_document_operations.cs +++ b/src/ValueTypeTests/Vogen/long_based_document_operations.cs @@ -18,7 +18,7 @@ public long_based_document_operations() theStore = DocumentStore.For(opts => { opts.Connection(ConnectionSource.ConnectionString); - opts.DatabaseSchemaName = "strong_typed"; + opts.DatabaseSchemaName = "strong_typed7"; }); theSession = theStore.LightweightSession(); diff --git a/src/ValueTypeTests/Vogen/string_id_document_operations.cs b/src/ValueTypeTests/Vogen/string_id_document_operations.cs index 516cd2d528..72a5376c5b 100644 --- a/src/ValueTypeTests/Vogen/string_id_document_operations.cs +++ b/src/ValueTypeTests/Vogen/string_id_document_operations.cs @@ -20,7 +20,7 @@ public string_id_document_operations() theStore = DocumentStore.For(opts => { opts.Connection(ConnectionSource.ConnectionString); - opts.DatabaseSchemaName = "strong_typed"; + opts.DatabaseSchemaName = "strong_typed8"; opts.ApplicationAssembly = GetType().Assembly; opts.GeneratedCodeMode = TypeLoadMode.Auto; diff --git a/src/ValueTypeTests/include_usage.cs b/src/ValueTypeTests/include_usage.cs index dea3ccd270..78a019f540 100644 --- a/src/ValueTypeTests/include_usage.cs +++ b/src/ValueTypeTests/include_usage.cs @@ -25,7 +25,7 @@ public include_usage(ITestOutputHelper output) theStore = DocumentStore.For(opts => { opts.Connection(ConnectionSource.ConnectionString); - opts.DatabaseSchemaName = "strong_typed"; + opts.DatabaseSchemaName = "strong_typed24"; opts.ApplicationAssembly = GetType().Assembly; opts.GeneratedCodeMode = TypeLoadMode.Auto;