Can't you just wrap it in another class/interface and use that?
Like this:
public interface IValidatorEngine
{
bool IsValid(object entity);
InvalidValue[] Validate(object entity);
}
public class ValidatorEngineWrapper : IValidatorEngine
{
private static ValidatorEngine engine
{
get { return Environment.SharedEngineProvider.GetEngine(); }
}
public bool IsValid(object entity)
{
return engine.IsValid(entity);
}
public InvalidValue[] Validate(object entity)
{
return engine.Validate(entity);
}
}
2010/8/5 Jérôme Avoustin <[email protected]>
> Hi !
>
> I'd like to use ValidatorEngine in my classes.
> I inject a singleton instance to all these classes, thanks to Autofac.
> But now I want to unit test my classes, and I can't find a way to mock
> ValidatorEngine (yes ! I'm a mockist !) : no interface and no virtual
> methods... like a .NET class in fact ! :) (Yes I know about Typemock
> Isolator and mocks frameworks like that, but I think they encourage
> bad design...)
>
> So, since MS did a reaaaaaally bad choice by not making methods
> virtual by default (fu#*$ing sh%µ*t !!), is there a way, in NHibernate
> Validator framework, to handle this ?
>
> Thanks !
>
> Jérôme
>
> --
> You received this message because you are subscribed to the Google Groups
> "nhusers" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected]<nhusers%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/nhusers?hl=en.
>
>
--
You received this message because you are subscribed to the Google Groups
"nhusers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/nhusers?hl=en.