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

android - net_scheduler holding wakelock -

sql - MySQL : Getting Entries from a many-to-many table -

java - Retrieving data from database using jsp (Hibernate + Spring + Maven) -