I'm hoping that someone here can give me a helping hand.
We have started to expand the number of tests in our products which is based off Umbraco, and for this reason we of cause want to test as much as possible with automated unit tests.
Similar question here - have some functionality that effectively requires getting all child nodes that match certain criteria (via some linq).
There's a great article on Skrift that starts to go into some detail on this, effectively mocking IPublishedContent items then mocking the return object of TypedContent. It starts from the "Complex Situation" heading in the article.
We're working through an implementation of this now so will report back if we get it up and running, but would be interested if others have solved this issue in different ways?
I would like to have an Test which has real database and real published content so that this could be possible:
var data= UmbracoHelper.TypedContet(1234)
Assert.IsTrue(data.GetPropertyValue<bool>("db real property and data"))
I don't want to speak with Mock.
I just want to use real database and published content (cache).
I saw this post from "Skrift" just I don't get it, how to configure all those dependencies ;). Basically, DbContext and IPublishedContent should be injected with real data, if someone has solution for this?
Testing with Umbraco and TypedContent
Hi everyone,
I'm hoping that someone here can give me a helping hand. We have started to expand the number of tests in our products which is based off Umbraco, and for this reason we of cause want to test as much as possible with automated unit tests.
For starters we have take some inspiration from this blog post: http://blog.aabech.no/archive/the-basics-of-unit-testing-umbraco/
However while this solves some of the problems that we had encountered with testing, we still have one glaring problem.
How can we fake the results from the UmbracoHelper.TypedContent & TypedMedia?
Similar question here - have some functionality that effectively requires getting all child nodes that match certain criteria (via some linq).
There's a great article on Skrift that starts to go into some detail on this, effectively mocking
IPublishedContent
items then mocking the return object ofTypedContent
. It starts from the "Complex Situation" heading in the article.We're working through an implementation of this now so will report back if we get it up and running, but would be interested if others have solved this issue in different ways?
I would like to have an Test which has real database and real published content so that this could be possible:
var data= UmbracoHelper.TypedContet(1234) Assert.IsTrue(data.GetPropertyValue<bool>("db real property and data"))
I don't want to speak with Mock. I just want to use real database and published content (cache).
I saw this post from "Skrift" just I don't get it, how to configure all those dependencies ;). Basically, DbContext and IPublishedContent should be injected with real data, if someone has solution for this?
is working on a reply...