|
From: Chris T. <cti...@av...> - 2004-04-21 02:12:08
|
I have defined the following interface:=20
public interface IWithOverloadedIndexer=20
{=20
string this[int index]{get;}=20
string this[Guid ID]{get;}=20
}=20
And the following test (I've tried with SetupResult and
ExpectAndReturn):=20
[Test] public void VerifyThatSetupOfMultipleIndexersFail()=20
{=20
DynamicMock mock =3D new DynamicMock(typeof(IWithOverloadedIndexer));=20
mock.SetupResult("Item","I will Fail",typeof(int));=20
}=20
When I run the test, I get the following error:=20
TestCase 'NMock.DynamicMockTest.VerifyThatSetupOfMultipleIndexersFail'
failed: System.Reflection.AmbiguousMatchException : Ambiguous match
found.=20
at System.RuntimeType.GetPropertyImpl(String name, BindingFlags
bindingAttr, Binder binder, Type returnType, Type[] types,
ParameterModifier[] modifiers)=20
at System.Type.GetProperty(String name, BindingFlags bindingAttr)=20
C:\Utilities\nMock\nmock\src\NMock\MethodSignature.cs(50,0): at
NMock.MethodSignature.FindMatchingPropertyOn(Type type)=20
C:\Utilities\nMock\nmock\src\NMock\DynamicMock.cs(98,0): at
NMock.DynamicMock.GetReturnTypeForSignature(MethodSignature signature)=20
C:\Utilities\nMock\nmock\src\NMock\DynamicMock.cs(73,0): at
NMock.DynamicMock.CheckReturnTypeIsValid(MethodSignature signature,
Object returnVal)=20
C:\Utilities\nMock\nmock\src\NMock\DynamicMock.cs(61,0): at
NMock.DynamicMock.SetupResult(String methodName, Object returnVal,
Type[] argTypes)=20
c:\utilities\nmock\nmock\test\nmock\dynamicmocktest.cs(390,0): at
NMock.DynamicMockTest.VerifyThatSetupOfMultipleIndexersFail()=20
I have stepped through the code and it looks as if though we are always
assuming that Properties will have no parameters.=20
|