返回一個密封類運行該代碼的方法: _foo = MockRepository.GenerateStub<IBar>();
_foo.Stub(x => x.Foo()).Return("sdf");
當 public interface IBar
{
string Foo();
}
public class Bar : IBar
{
public string
我想末梢模擬對象的#class方法: describe Letter do
before(:each) do
@john = mock("John")
@john.stub!(:id).and_return(5)
@john.stub!(:class).and_return(Person) # is this ok?
@john.stub!(:na
我試圖通過將TDD應用到我的一個簡單項目來學習TDD。一些細節(和前面一個問題)在這裏: TDD: Help with writing Testable Class 的細節是我有了個PurchaseOrder(在構造函數傳遞)的私有列表中PurchaseOrderCollection類,而個PurchaseOrders有一個布爾屬性的IsValid 。 PurchaseOrderCollectio