This is a migrated thread and some comments may be shown as answers.

Getting error while trying to mock RoleEnvironment.CurrentRoleInstance

1 Answer 21 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Shashank
Top achievements
Rank 1
Shashank asked on 28 Mar 2013, 04:07 PM
My sample code:

Assert.IsTrue(Mock.IsProfilerEnabled);
Mock.SetupStatic<RoleEnvironment>();            
Mock.Arrange(() => RoleEnvironment.CurrentRoleInstance.Id).Returns("TEST");

Error Msg: 

Method 'set_Id' in type 'RoleInstanceProxy+79c0aa98ec994a37a2e00052dd3aa3bd' from assembly 'Telerik.JustMock.DynamicStrong, Version=1.0.0.0, Culture=neutral, PublicKeyToken=8b221631f7271365' does not have an implementation.

StackTrace:

at System.Reflection.Emit.TypeBuilder.TermCreateClass(RuntimeModule module, Int32 tk, ObjectHandleOnStack type)
   at System.Reflection.Emit.TypeBuilder.CreateTypeNoLock()
   at System.Reflection.Emit.TypeBuilder.CreateType()
   at Telerik.JustMock.DynamicProxy.TypeEmitter.CreateType()
   at Telerik.JustMock.DynamicProxy.Proxy.CreateType()
   at Telerik.JustMock.DynamicProxy.ProxyFactory.Create()
   at Telerik.JustMock.DynamicProxy.Fluent.FluentProxy.NewInstance()
   at Telerik.JustMock.DynamicProxy.Proxy.Create(Type type, Action`1 action)
   at Telerik.JustMock.MockManager.CreateProxy(Type targetType, Container container)
   at Telerik.JustMock.MockManager.CreateProxy()
   at Telerik.JustMock.Utility.CreateMockWithEmptyArgs(Type target, Behavior behavior)
   at Telerik.JustMock.Interceptors.MethodInterceptor.OnMethodExecuting(MethodInvocation invocation)
   at Telerik.JustMock.Interceptors.MockInterceptor.OnExecution(MethodInvocation invocation)
   at Telerik.JustMock.Interceptors.MockInterceptor.Execute(MethodInvocation invocation)
   at Telerik.JustMock.Interceptors.MockInterceptor.Intercept(MockInvocation invocation)
   at Telerik.JustMock.Weaver.Interceptors.WeaverInterceptor.Telerik.JustMock.Weaver.Interceptors.Abstraction.IWeaverInterceptor.Intercept(IInvocation invocation)
   at Telerik.JustMock.Handlers.WeaverInterceptorHandler.Invoke(Object[] args)
   at Telerik.JustMock.MockContext`1.SetupMock(MockExpression`1 expression)
   at Telerik.JustMock.MockContext`1.SetupMock(Expression`1 expression)
   at Telerik.JustMock.Mock.<>c__DisplayClass1`1.<Arrange>b__0(MockContext`1 x)
   at Telerik.JustMock.MockContext.Setup[TDelgate,TReturn](Instruction instruction, Func`2 function)
   at Telerik.JustMock.Mock.Arrange[TResult](Expression`1 expression)





1 Answer, 1 is accepted

Sort by
0
Kaloyan
Telerik team
answered on 29 Mar 2013, 03:06 PM
Hello Shashank,

As I have replied in your support ticket with ID 676396:

  • It appears, this is a bug in JustMock on which our development team is currently working. It seems that, at this point our product is not able to create mocks for internal abstract members.

    A solution to the matter should be shipped with one of the future JustMock releases.
I hope this helps.

All the best,
Kaloyan
the Telerik team
Share what you think about JustTrace & JustMock with us, so we can become even better! You can use the built-in feedback tool inside JustTrace, our forums, or our JustTrace or JustMock portals.
Tags
General Discussions
Asked by
Shashank
Top achievements
Rank 1
Answers by
Kaloyan
Telerik team
Share this question
or