문제

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?

도움이 되었습니까?

해결책

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

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top