chevron-thin-right chevron-thin-left brand cancel-circle search youtube-icon google-plus-icon linkedin-icon facebook-icon twitter-icon toolbox download check linkedin phone twitter-old google-plus facebook profile-male chat calendar profile-male
0 votes

I cannot mock the Text property from Syncfusion.Windows.Forms.Tools.XPMenus.ComboBoxBarItem.

Here's my test code
        [Test, Isolated]
        public void ComboItemBarItemTest()
            ComboBoxBarItem cb = Isolate.Fake.Instance<ComboBoxBarItem>(Members.ReturnRecursiveFakes);
            Isolate.WhenCalled(() => cb.Text).WillReturn("20");

And here's the exception I'll get at the Isolate.WhenCalled line:
failed: System.Reflection.TargetInvocationException : Exception has been thrown by the target of an invocation.
  ----> System.TypeInitializationException : The type initializer for 'Syncfusion.Windows.Forms.Tools.XPMenus.BarItem' threw an exception.
  ----> System.ArgumentOutOfRangeException : Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
   at System.RuntimeMethodHandle._InvokeMethodFast(Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)
   at System.RuntimeMethodHandle.InvokeMethodFast(Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)
   at System.Delegate.DynamicInvokeImpl(Object[] args)
   at System.Delegate.DynamicInvoke(Object[] args)
   at TypeMock.ArrangeActAssert.Recorder`1.a()
   at TypeMock.ArrangeActAssert.Recorder`1.a(T A_0)

Concept X6 ActiveHybrid
asked by nsoonhui (59.1k points)

2 Answers

0 votes

I just wanted you to know I'm looking into this issue and I'll update you here when I find out the root cause to it.

Typemock support
answered by doron (17.2k points)
0 votes
Typemock Isolator 5.1.2 that was released today fixes this issue.
answered by dhelper (11.9k points)