AI OnAI Off
Try this:
[Test]
public void Foo()
{
var product = new ProductPage();
product.Property["PageLink"] = new PropertyPageReference(PageReference.EmptyReference);
Assert.AreEqual(product.ContentLink, ContentReference.EmptyReference);
}
The same goes for ProductName. You can't use strongly typed properties :(
Hi all
I'm trying to instaniate the ContentLink property of an object inheriting from pagedata. I want to do this to unit test episerver find but i think the question is general so I'll ask in this forum. So far I've tried
var product = new ProductPage { ProductName = "Product 1"}; ((IContent)product).ContentLink = ContentReference.EmptyReference;
Which crashes at runtime saying the property doesn't exist. And
var product = new ProductPage { ProductName = "Product 1"}; product.Property.Add("ContentLink", ContentReference.EmptyReference);
Which won't compile. I'm trying to instaniate a ContentInLanguageReference object to mock up some episerver find test results and disassembling it shows that it accesses the ContentLink and will (and does) crash if it is null
All help gratefully received.
Many Thanks