开发者

Telerik JustMock a Property Read

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 intercept开发者_如何学Going 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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜