I have a problem with this code:
Mock.Arrange(...) throws the following exception:
System.NullReferenceException occurred
Message=Object reference not set to an instance of an object.
Source=Telerik.JustMock
StackTrace:
at ..(Type valueType, Object value) in c:\B\Basilisk\Basilisk CI Build\Sources\CodeBase\Telerik.JustMock\Utility.cs:line 334
InnerException:
If I change the Arrange method to use Arg.IsAny<Guid>() instead of the explicit value there is no exception and everything works fine.
I am using the latest internal JustMock Free Edition build 2011.1.620.0.
Also test it on the official build and the results were the same.
Hope that will help you solve the problem.
public
interface
IProcessDataPersister
{
List<TaskWarning> GetTaskWarnings(Guid taskId);
}
//in a method
var localPersister = Mock.Create<IProcessDataPersister>();
Mock.Arrange(() => localPersister.GetTaskWarnings(
new
Guid(
"{00000000-0000-0000-0001-000000000003}"
)))
.Returns(
new
List<TaskWarning>() {
new
TaskWarning(
new
Guid(
"{00000000-0000-0000-0001-000000000003}"
)) { EscalationLevel = 0 } })
.MustBeCalled();
Mock.Arrange(...) throws the following exception:
System.NullReferenceException occurred
Message=Object reference not set to an instance of an object.
Source=Telerik.JustMock
StackTrace:
at ..(Type valueType, Object value) in c:\B\Basilisk\Basilisk CI Build\Sources\CodeBase\Telerik.JustMock\Utility.cs:line 334
InnerException:
If I change the Arrange method to use Arg.IsAny<Guid>() instead of the explicit value there is no exception and everything works fine.
I am using the latest internal JustMock Free Edition build 2011.1.620.0.
Also test it on the official build and the results were the same.
Hope that will help you solve the problem.