Question

I am trying to mock a Property using Telerik JustMock.

        public WorkitemBusinessObject mock()
    {
        var mockContext = Mock.Create<BusinessObjectContext<Workitem>>();

        var workitemList = new List<Workitem> { 
            new Workitem {Title="First Workitem"}
        };

        Mock..Arrange(() => mockContext.Table).Returns(workitemList.AsQueryable<Workitem>);
        Mock.Arrange(() => mockContext.Query).CallOriginal();
        Mock.Arrange(() => BusinessObjectContext<Workitem>.TableName).CallOriginal();

        node.context = mockContext;

        return this;
    }

This does not work. It gives an exception with the title "Opps , there were some error intercepting target call. - Exception"

Any ideas?

Was it helpful?

Solution

As specified in the forum, this is could be a reason as you are not getting the addin working in VS2010 while you are trying to mock concrete member.

With the class you provided me, I will check it out and keep you posted on this. Also, it can be the reason that you are using a localized version of visual studio, there is a issue we found regarding it and will keep the thread updated with any progress.

Regards,

Mehfuz

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top