Skip to content
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

Allow passing a custom StreamNameBuilder into MockRepositorySpecification #134

Open
dealproc opened this issue Jan 13, 2023 · 2 comments
Open

Comments

@dealproc
Copy link

In my code, I am working within a shared core. As part of the testing, I need to write tests to ensure ACLs are working accurately within the same ESDB instance. The problem comes when I need to do [Domain1].[Aggregate] and [Domain2].[Aggregate], as the default PrefixedCamelCaseStreamNameBuilder does not properly build the stream names to support multiple domains.

For now, I am going to cut & paste the code for MockRepositorySpecification and adjust to my needs. With that said, if there could be an adjustment to the constructor, providing an overload which allows passing a preferred IStreamNameBuilder to allow for testing scenarios such as these. Thoughts?

@joshkempner
Copy link
Contributor

The PrefixedCamelCaseStreamNameBuilder is meant to build aggregates for a single schema. I don't think it would be a good idea to create a custom stream name builder to support multiple schemas since it would also require a new custom IRepository implementation that also supports multiple schemas. I think it would be cleaner to create multiple repositories to access the same mock stream store, one repo for each schema. The MockRepositorySpecification doesn't support this, but we could easily have a similar class (MockMultiRepositorySpecification?) to support multiple mock repos for multiple schemas.

@condron Your thoughts?

@joshkempner
Copy link
Contributor

I've pushed a proposed implementation to this branch. It needs unit tests, but I think the test fixture itself is reasonably complete. Please post thoughts/comments on it here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants