Skip to content

Should I inject factories as interfaces for unit testing with CSLA? #4373

Discussion options

You must be logged in to vote

@sacrejohn I think it depends on what you intend to test, and whether you are doing unit tests or integration tests.

I typically write unit tests for

  1. My actual DAL (below the data portal - so no CSLA involved basically)
  2. My rule classes (independent of any properties to which they are attached)

Then I write integration tests for the business layer, typically running against an in-memory "database" using a mock DAL. This test code is basically like the UI code that would be interacting with the domain business types.

Sometimes I've written UI tests, though usually (in my experience) this is done by a dedicated QA group that writes automated tests using a variety of tools (such as Playwrig…

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
1 reply
@sacrejohn
Comment options

Answer selected by sacrejohn
Comment options

You must be logged in to vote
1 reply
@Chicagoan2016
Comment options

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