c# - Mocking Interface as non-nullable instance with RhinoMocks -
i have written method suggested in https://stackoverflow.com/a/79903/976896. in short method accepts kind of enums argument , basic checking.
public void saveintvaluefromenum<t>(t value) t : struct, iconvertible { if (!typeof(t).isenum) { throw new argumentexception("t must enumerated type"); } this.intvalue = convert.toint32(value); }
now want write test this, validates when non enum type feed it, exception thrown. wanted generate dummy object follow rhinomocks.
var mock = mockrepository.generatemock<iconvertible>();
but method doesn't accepts nullable type.
is there way mock structs/non-nullable instances rhinomocks?
edit: updated code listing
Comments
Post a Comment