So after getting everything changed over I have major issues with tests passing now. I get a lot of my tests failing for a Duplicate Type Name with Assembly exception coming out of some CheckTypeNameConflict function the .net Reflect namespace.
I have this snippet for an example of a fixture that will fail with this:
public class TestPowertrainMotorPropertyConverter
private PowertrainMotorPropertyConverter converter;
private IPropertiesLocalizer localizer;
public void SetUp()
localizer = (PropertiesLocalizer)(new Mockery().NewMock(typeof(PropertiesLocalizer)));
converter = new PowertrainMotorPropertyConverter();
public void test_ConvertTo()
ArrayList pairs = PowertrainMotorModeEnumConverter.GetHumanReadablePairs();
foreach (EnumHumanReadablePair pair in pairs)
PowertrainMotorData data = new PowertrainMotorData();
data.Mode = (PowertrainMotorMode)pair.Value;
PowertrainMotorProperty property = new PowertrainMotorProperty(localizer, data);
string gotName = (string)converter.ConvertTo(property, typeof(string));
Assert.AreEqual("Motor Mode: " + pair.HumanReadableName, gotName, "wrong name");
Does anyone know what is wrong with what I am doing?
Could you please provide a complete (minimal) unit test including the class you are testing?
Otherwise we don't know how to reproduce your problem.
If it is too large for the forum, please send your code to ursenzler at users.sourceforge.net and I'll take a look at it.
I was trying to mock a class and not an Interface. It was fat finger on my part. It took me some time but I figured it out.
I do have another question that I am starting on a new thread about the old IsCloseTo constraint.
I'll have a look at the code whether we should throw a clearer exception that says that an interface type is required.
I improved the exception message that is shown if a class is mocked. You can find this in revision 70 in our svn repository.