I have two classes like this
public abstract class Foo<T> where T : Bar {
...
protected abstract Bar Do(T obj);
}
public abstract class FooWithGoo<T> : Foo<T> where T:Bar {
public FooWithGoo(string x) {...}
...
}
Trying to mock this in a unit test using Moq with this line new Mock<FooWithGoo<BarSub>>("abc") gives me this exception.
System.ArgumentException: Type to mock must be an interface or an abstract or non-sealed class. ---> System.TypeLoadException: Method 'Do' in type 'Castle.Proxies.FooWithGoo``1Proxy' from assembly 'DynamicProxyGenAssembly2, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' does not have an implementation.
Is there something I am doing wrong here? How can I mock this?
Aucun commentaire:
Enregistrer un commentaire