¡@

Home 

2014/10/15 ¤U¤È 10:08:50

iphone Programming Glossary: fakensurlconnection

Testing class method using OCMock release 2.1.1

http://stackoverflow.com/questions/16461274/testing-class-method-using-ocmock-release-2-1-1

fake NSURLConnection which you should be able to apply to your class as well. Start by extending your class @interface FakeNSURLConnection NSURLConnection id sharedInstance void setSharedInstance id sharedInstance void enableMock id mock void disableMock NSURLConnection.. a public instance method with the same signature as the class method. Let's look at the implementation @implementation FakeNSURLConnection SHARED_INSTANCE_IMPL FakeNSURLConnection SWAP_METHODS_IMPL NSURLConnection FakeNSURLConnection DISABLE_MOCK_IMPL FakeNSURLConnection.. as the class method. Let's look at the implementation @implementation FakeNSURLConnection SHARED_INSTANCE_IMPL FakeNSURLConnection SWAP_METHODS_IMPL NSURLConnection FakeNSURLConnection DISABLE_MOCK_IMPL FakeNSURLConnection ENABLE_MOCK_IMPL FakeNSURLConnection..