lundi 3 août 2015

Unit test case for call back methods ios

I have a following method in my app for which I need to write unit test cases.
Can anyone suggest how can I test whether the success block or error block is called.

- (IBAction)loginButtonTapped:(id)sender

    {

          void (^SuccessBlock)(id, NSDictionary*) = ^(id response, NSDictionary* headers) {

            [self someMethod];

        };

        void (^ErrorBlock)(id, NSDictionary*, id) = ^(NSError* error, NSDictionary* headers, id response) {

         // some code

        };

            [ServiceClass deleteWebService:@“http://someurl"

                                               data:nil

                                   withSuccessBlock:SuccessBlock

                                     withErrorBlock:ErrorBlock];

    }

Aucun commentaire:

Enregistrer un commentaire