Skip to content

Functional tests of Command execution and projections #66

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Apr 8, 2025

Conversation

agehrke
Copy link
Collaborator

@agehrke agehrke commented Apr 4, 2025

This PR adds functional tests of Command execution and projections.

The concept is:

  • Build a host with EventStore and CQRS - see CqrsTestHost.cs
  • Replace IEventStoreClient with an in memory implementation (like the existing InMemoryStore) - the implemention in InMemoryEventStoreClient.cs actually works :)
  • Commands are executed and side-effects asserted

Please give input on everything from style, placement of files, code design, etc.

@LarsSkovslund
Copy link
Collaborator

The build failed with the following errors
image

You should get the same errors when building in release mode locally.

@christianhelle christianhelle added the enhancement New feature or request label Apr 4, 2025
@christianhelle christianhelle requested a review from Copilot April 4, 2025 10:33
@agehrke
Copy link
Collaborator Author

agehrke commented Apr 4, 2025

The build failed with the following errors image

You should get the same errors when building in release mode locally.

I do get the warnings in a debug build. I really don't understand the issue. The analyzer says that

error S3604: Remove the member initializer, all constructors set an initial value for the member.

How can this be true for reference types? Maybe I should upgrade the analyzer?

Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot reviewed 6 out of 8 changed files in this pull request and generated 1 comment.

Files not reviewed (2)
  • test/Atc.Cosmos.EventStore.Cqrs.Tests/Atc.Cosmos.EventStore.Cqrs.Tests.csproj: Language not supported
  • test/Directory.Build.props: Language not supported
Comments suppressed due to low confidence (1)

test/Atc.Cosmos.EventStore.Cqrs.Tests/Functional/InMemoryEventStore.cs:50

  • The string literal "leasetoken" appears to be a typo. Consider renaming it to "leaseToken" for clarity.
await sub.ExceptionHandler("leasetoken", ex);

@agehrke
Copy link
Collaborator Author

agehrke commented Apr 4, 2025

Ok, the issue is in SonarAnalyzer, so I have upgraded it and fixed two new issues:

  • InMemoryStore.cs - Warning S6612 : Use the lambda parameter instead of capturing the argument 'name'
  • ProjectionFilter.cs - Warning S6608 : Indexing at Count-1 should be used instead of the "Enumerable" extension method "Last"

@agehrke agehrke force-pushed the tests branch 2 times, most recently from 0679db2 to 6d94bc4 Compare April 8, 2025 08:16
@christianhelle christianhelle self-assigned this Apr 8, 2025
@christianhelle christianhelle merged commit 3d0d7ea into atc-net:main Apr 8, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants