0
내 단위 테스트에 RhinoMock을 사용하고 있는데 어떻게 설정해야하는지 알고 싶습니다. 특정 메소드가 항상 매개 변수로받은 것과 동일한 객체를 반환합니다. 내가 만들기 메서드를 호출 할 때마다의 조롱 스텁이로 전달 된 같은 객체를 반환하는 방식으로 RhinoMocks을 설정하려는RhinoMocks에 매개 변수로 전달 된 동일한 객체를 반환하도록 지정하는 방법
public interface IItemRepository
{
Item Craete(Item item);
}
:
이
내가 조롱하고자하는 인터페이스입니다 매개 변수.[TestInitialize]
public void CrateServiceWithMockRepository()
{
var stubRepository = MockRepository.GenerateStub<IItemRepository>();
// ... how to set-up the stubRepository as described above ...
// Create the target service for this unit test
this.targetService = new ServiceXYZ(stubRepository);
}