Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
I have a mocked the GetByEmail method to return a mocked IMember. The returned IMember is the basic IMember with no extended properties.
To progress thought the test I have to be able to call SetValue on the IMember, as this happens in the code I am testing.
So in the code I am testing I have
var customMember = _memberService.GetByEmail(member.Email);
And in the test I have
_mockMemberService.Setup(x => x.GetByEmail(It.IsAny<string>())).Returns(new Member("test name", new MemberType(12)));
Then in the code I set a value:
customMember.SetValue("firstName", member.FirstName);
But this crashes the test as there is no firstName property on IMember, although there is in the back office.
How can I mock adding or setting these extended properties?
Thanks
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.
Continue discussion
Setting extended properties on a mocked IMember in Nunit
I have a mocked the GetByEmail method to return a mocked IMember. The returned IMember is the basic IMember with no extended properties.
To progress thought the test I have to be able to call SetValue on the IMember, as this happens in the code I am testing.
So in the code I am testing I have
And in the test I have
Then in the code I set a value:
But this crashes the test as there is no firstName property on IMember, although there is in the back office.
How can I mock adding or setting these extended properties?
Thanks
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.