November Happy Hour will be moved to Thursday December 5th.
AI OnAI Off
November Happy Hour will be moved to Thursday December 5th.
Did you read this post? http://www.meadow.se/wordpress/unit-testing-an-episerver-contentarea/
Hi there,
We would like to unit test a validator that ensures a content area doesn't have two blocks inside it:
The problem we are facing is: how can we programatically add a second block to a content area, while inside the test project?
We have tried this approach: https://stackoverflow.com/questions/27993939/episerver-add-block-to-a-content-area-programmatically but that seems to work only in the main application (ContentReference.GlobalBlockFooter is null in the test project).
In case it helps, here is the data model.
And here is what we have tried:
However, it throws a null reference exception when we try to add the ContentAreaItem to the ContentArea (using model.HeroBlock.Items.Add). The exact error is: