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
Hi,

After upgrading to 4.2.2 from 4.1.0 I get the following exception with one of my tests that was passing under 4.1.0.

Cheers
Don

==========================

failed: System.Reflection.AmbiguousMatchException : Ambiguous match found.
at System.RuntimeType.GetField(String name, BindingFlags bindingAttr)
at TypeMock.Mock.b(Object A_0)
at TypeMock.Mock.d(Object A_0)
at TypeMock.RecorderManager.a(String A_0, String A_1, Object A_2, Type A_3, Boolean A_4)
at TypeMock.RecorderManager.a(String A_0, String A_1, Object A_2, Object[] A_3, MethodBase A_4, Object A_5, StackTrace A_6)
at TypeMock.MockManager.a(String A_0, String A_1, Object A_2, Object A_3, Boolean A_4, Object[] A_5)
at TypeMock.InternalMockManager.getReturn(Object that, String typeName, String methodName, Object methodParameters, Boolean isInjected, Object p1, Object p2)
C:SiegeMainToolsEditor2ViewMaterialEditorView.Designer.cs(8,0): at SiegeManaged.Editor.View.MaterialEditorView..ctor(MaterialAsset material, Project project)
C:SiegeMainToolsEditor2TestTestEditorViewFactory.cs(35,0): at SiegeManaged.Editor.Test.TestEditorViewFactory.CreatesMaterialEditorViewForMaterialAsset()
at TypeMock.VerifyMocksAttribute.Execute()
at TypeMock.DecoratorAttribute.CallDecoratedMethod()
at TypeMock.ClearMocksAttribute.Execute()
at TypeMock.MethodDecorator.e()
at TypeMock.MockManager.a(String A_0, String A_1, Object A_2, Object A_3, Boolean A_4, Object[] A_5)
at TypeMock.InternalMockManager.getReturn(Object that, String typeName, String methodName, Object methodParameters, Boolean isInjected)
C:SiegeMainToolsEditor2TestTestEditorViewFactory.cs(31,0): at SiegeManaged.Editor.Test.TestEditorViewFactory.CreatesMaterialEditorViewForMaterialAsset()
________
herbalaire review
asked by rorydriscoll (3.8k points)

3 Answers

0 votes
Hi
Can you please post the test code?
answered by ohad (35.4k points)
0 votes
When I mock the constructor of a class derived from a sandDock.DockControl (http://www.divil.co.uk/net/controls/sanddock/) an AmbiguousMatchException occurs.

TypeMock v 4.2.3

Cheers

Don
===================================

using NUnit.Framework;
using TD.SandDock;
using TypeMock;

namespace TypeMockIssue
{
public class DerivedDockControl : DockControl
{
public DerivedDockControl()
{
}

public override void Open()
{
}
}


[TestFixture]
[ClearMocks]
public class Test
{
[SetUp]
public void Setup()
{

}

[Test]
[VerifyMocks]
public void WhatDoesTheExceptionMean()
{
using (RecordExpectations recorder = RecorderManager.StartRecording())
{
DerivedDockControl derivedDockControl = new DerivedDockControl();
}
}
}
}
answered by donb (140 points)
0 votes
Hi,

This indeed look like a bug :cry:
We shall start working on a fix.
answered by lior (13.2k points)
...