문제

I have a problem in C# unit test. When I test some methods, They are need to convert original interface. like this:

_stubInterface1 = MockRepository.GenerateMock<Interface1>();
...
var someData = (Interface1)_stubInterface1;

Then CLR throw exception. Do you have any idea?

도움이 되었습니까?

해결책

Sorry. My question has error. I mean that:

_stubInterface1 = MockRepository.GenerateMock<Interface1>();
...
var someData = (Interface2)_stubInterface2;

solution:

_stubInterface1 = MockRepository.GenerateMock<Interface1,Interface2>();
...
var someData = (Interface2)_stubInterface2;

Thanks all reply and all guys.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top