當我想驗證一個方法的模擬對象是在一個特定的順序接收的一些消息我做這樣的事情: // sut is an instance of the class I am testing and myMock is a mock object injected in sut.
// I want to test that myMock sends messageA and then messageB, in
我花了整個下午拖網教程和使用OCMock的例子網頁,但如果可能,我已經仍然不知道如果是如何組合使用它與NSURLConnection的建立測試代碼,以模擬服務器發送數據以響應HTTP POST或GET。 有誰知道一個方便的教程,這樣做的? 更新:我後來碰到這個傳來: how to unit test a NSURLConnection Delegate?
我正在學習在單元測試中使用OCMocks,並且我理解基礎知識。但是,我不確定我如何模擬對類方法的調用。 我想有: [[UIDevice currentDevice] userInterfaceIdiom]
回報我的測試案例不同(但有效)接口的成語。 id mock = [OCMockObject mockForClass:[UIDevice class]];
// Would I use