Redis Cache Clear C# -


i try remove data using method above

public virtual void clearordertypecache() {     ordertypelist = null;     cacheservice.set<ordertypeprojection[]>(ordertypecachekey, null); } 

but i've got exception when try use it

icacheservice.set<ordertypeprojection[]>("189b5a92-e728-405a-b13a-e3b62c870845-ordertypes", null)  invocation failed mock behavior strict. invocations on mock must have corresponding setup.' 

i hope help.

you creating mock<>, uses mockbehavior.strict default which

mockbehavior.strict : causes mock throw exception invocations don't have corresponding setup.

somewhere in code invoking members have no setup configured. suggest create setup members intend invoke during tests

like this:

var httpstatuscode = system.net.httpstatuscode.badrequest;//or ever want responsemessage.setup(m => m.statuscode).returns(httpstatuscode); responsemessage.setup(m => m.readcontentasstring()).returns("put return string here"); 

Comments

Popular posts from this blog

angular - Ionic slides - dynamically add slides before and after -

minify - Minimizing css files -

Add a dynamic header in angular 2 http provider -