iphone - Unable to set values in NSMutableDictionary in Unit tests -


i writing unit tests in ghunit test framework. have nsmutabledictionary detailsdict defined in application delegate.

in application delegate set values in & save it. works fine in app when try call method set values on in unit tests not able set value & dictionary remains empty.

in test case alloc init appdelegate. message method object sets few keys when check values remains empty.

is there dont know unit testing or missing....?

any answers pointers highly appreciated.

edit: got had separately alloc init detailsdic variable this

#ifdef unit_testing     detailsdict = [[nsmutabledictionary alloc] init]; #endif 

still open other answers on other ways of doing this.

you can't alloc , init variable. can alloc , init object, , indeed need alloc , init nsmutabledictionary object somewhere.

the proper place somewhere run both application , every test case. app delegate's init method choice.

that said, i'd app delegate should not exist @ in unit tests, because unit tests not application. should split out whatever functionality mean test 1 or more separate controllers, create , work app delegate , relevant unit tests.


Comments

Popular posts from this blog

java - SNMP4J General Variable Binding Error -

windows - Python Service Installation - "Could not find PythonClass entry" -

Determine if a XmlNode is empty or null in C#? -