I am using WPF JustMock to create unit tests and am trying to create an argument matcher for a property setter in a mock arrangement as below.
Mock.ArrangeSet(() => mockSelectionRuleRow.SelectedRuleAttribute = Arg.IsAny<RuleAttribute>())
.DoNothing();
RuleAttribute is a simple data class. Originally I wanted to have a matcher like "Arg.Matches<RuleAttribute>(x => x.Name == name)" but I was getting the AccessViolationException so I tried checking just any RuleAttribute and I am still getting the exception.
Note that I have other property setter arangements for mockSelectionRuleRow that are working just fine however they are checking specific values I have stored in local variables. In this case I cannot guarantee it is the same object, as internally the logic being tested may copy it.
The JustMock documentation shows using Arg.IsAny in an ArrangeSet, though it only shows using it with a primitive type (int). Is this sort of usage not supported?
This is the runtime exception (inner) I get when the above ArrangeSet executes. {"Attempted to read or write protected memory. This is often an indication that other memory is corrupt."}
Can anyone provide any guidance?