Notes on Integration Testing with OrchardCore #7059
mariojsnunes
started this conversation in
Show and tell
Replies: 2 comments 1 reply
-
Thank you for sharing your findings! Just a nitpick: These tests are not really unit tests but rather integration tests. For a unit test (i.e. a test that only checks a given method) you don't need to initialize an Orchard shell. |
Beta Was this translation helpful? Give feedback.
1 reply
-
I have a similar note: |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello guys,
I've been playing around with unit testing with OrchardCore in the past few weeks, and I want to share some of my notes.
For those who are not familiar with UnitTesting OrchardCore, you can check out this folder:
https://github.com/OrchardCMS/OrchardCore/tree/dev/test/OrchardCore.Tests/Apis/Context
Basically it has a global SiteContext, and then a Context for each controller or module that inherits from it.
What I found:
As seen here, if you want to run a test, you need all this code:
With this generic function, we can simplify all that to just one line:
The result:
Beta Was this translation helpful? Give feedback.
All reactions