c# - Moq item from session -


how can moq following returns new guid();

private void checksomething(){ ...     user = customercontext.current.user; // returns guid 

customercontext taken third party library , not injected class.

is there way it?

i did this.

public class usercontextwrapper : icustomusercontext {     public guid userguid     {         { return customercontext.current.user; }     } } 

then in code had modify original to:

private void checksomething(){ ...     user = usercontextwrapper.userguid ; // returns guid 

now i'm able mock. i'm injecting icustomerusercontext class , have mapped usercontextwrapper icustomusercontext in ioc container.


Comments

Popular posts from this blog

java - pagination of xlsx file to XSSFworkbook using apache POI -

Unlimited choices in BASH case statement -

apache - How do I stop my index.php being run twice for every user -