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
Welcome to Typemock Community! Here you can ask and receive answers from other community members. If you liked or disliked an answer or thread: react with an up- or downvote.
0 votes
I'm using Isolator 7.1.3.0 and I have the following test:

[TestClass]
public class UnitTest1
{
   [TestMethod]
   public void Test()
   {
      var fake = Isolate.Swap.AllInstances<Foo>().WithRecursiveFake();
      Isolate.WhenCalled(() => fake.GetBars()).WillReturnCollectionValuesOf(new[] { new Bar() });
   }
}

class Foo
{
   public Bar[] GetBars() { return new Bar[0]; }
}

class Bar { }


It throws the following exception:

Test method TestSandbox.UnitTest1.Test threw exception:
TypeMock.TypeMockException:
*** Conflict: cannot mock if there's more than one explicit implementation. Please set expectations to a fully qualified name:
System.Collections.IList.get_Item
System.Collections.IList.get_Item

at f8.a(Type A_0, String A_1)
at f8.b(Type A_0, String A_1, Type A_2, Type[] A_3)
at gr.a(MethodInfo A_0, MethodInfo A_1)
at gr.a(Object A_0, Object A_1, Boolean A_2)
at c0.a(Object A_0)
at c0.a(Object A_0)
at TypeMock.ArrangeActAssert.ExpectationEngine`1.<>c__DisplayClass22.a()
at ik.a(Object A_0, Boolean A_1, Func`1 A_2, Action A_3, Action A_4, Action A_5, Boolean A_6)
at TypeMock.ArrangeActAssert.ExpectationEngine`1.a(IEnumerable A_0)
at TestSandbox.UnitTest1.Test() in UnitTest1.cs: line 17


I don't understand the exceptions message, or why it is happening. Switching to .WillReturn() fixes this, but then I cannot pass my own List<Bar> and add items to it during the test (not shown in repro code above).
asked by allon.guralnek (10.6k points)

1 Answer

0 votes
Hi Allon,

Thank you for bringing our attention to this.

It does seem like a bug.

I will keep working on it and update you when we solve it.
answered by alex (18k points)
...