Getting error while trying to mock RoleEnvironment.CurrentRoleInstance

2 posts, 0 answers
  1. Shashank
    Shashank avatar
    1 posts
    Member since:
    Mar 2013

    Posted 28 Mar 2013 Link to this post

    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)





  2. Kaloyan
    Admin
    Kaloyan avatar
    872 posts

    Posted 29 Mar 2013 Link to this post

    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.
  3. DevCraft R3 2016 release webinar banner
Back to Top