Accessing Custom Properties from IMember (IContentBase) for Unit Testing
Currently I have got a mock IMember setup where I can access it's standard properties that are directly accessible (email, username, name etc) but any custom properties that are set in .SetValue from IContentBase I cannot access or set for that matter.
[TestFixture]
public class InactiveMemberCheckTest
{
private UmbracoSupport support = new UmbracoSupport();
private Mock<IMember> inactiveMemberEmailed;
[SetUp]
public void Setup()
{
support.SetupUmbraco();
this.inactiveMemberEmailed = new Mock<IMember>();
inactiveMemberEmailed.SetupAllProperties();
inactiveMemberEmailed.Object.LastLoginDate = DateTime.Today.AddMonths(-12);
inactiveMemberEmailed.Object.Name = "inactiveMemberEmailed";
inactiveMemberEmailed.Object.Email = "[email protected]";
inactiveMemberEmailed.Object.SetValue("contactId", 1);
inactiveMemberEmailed.Object.SetValue("inactiveCheckEmailed", true);
}
}
The contactId and inactiveCheckEmailed both are not being set. As mentioned previously all the other values are being set fine, it's just those 2 custom properties.
Could anybody point me in the right direction for this please? Thanks.
Accessing Custom Properties from IMember (IContentBase) for Unit Testing
Currently I have got a mock IMember setup where I can access it's standard properties that are directly accessible (email, username, name etc) but any custom properties that are set in .SetValue from IContentBase I cannot access or set for that matter.
The contactId and inactiveCheckEmailed both are not being set. As mentioned previously all the other values are being set fine, it's just those 2 custom properties.
Could anybody point me in the right direction for this please? Thanks.
There is no implementation of
SetValue
, so it is just a method call.Have a look at the quickstart here : https://github.com/Moq/moq4/wiki/Quickstart
is working on a reply...