Ejemplo n.º 1
0
 public void Init()
 {
     _customerServiceMock = new Mock <ICustomerService>();
     _httpAccessorMock    = new Mock <IHttpContextAccessor>();
     _customerSettings    = new CustomerSettings();
     _cookieAuthService   = new CookieAuthenticationService(_customerSettings, _customerServiceMock.Object, _httpAccessorMock.Object);
     //For mock HttpContext extension methods like SignOutAsync ,SignInAsync etc..
     _authServiceMock    = new Mock <IAuthenticationService>();
     serviceProviderMock = new Mock <IServiceProvider>();
     serviceProviderMock
     .Setup(_ => _.GetService(typeof(IAuthenticationService)))
     .Returns(_authServiceMock.Object);
     _httpContext = new DefaultHttpContext()
     {
         RequestServices = serviceProviderMock.Object
     };
     _httpAccessorMock.Setup(c => c.HttpContext).Returns(_httpContext);
 }
Ejemplo n.º 2
0
 public void Init()
 {
     _customerServiceMock     = new Mock <ICustomerService>();
     _genericAttributeService = new Mock <IGenericAttributeService>().Object;
     _httpAccessorMock        = new Mock <IHttpContextAccessor>();
     _customerSettings        = new CustomerSettings();
     _config = new GrandConfig();
     _config.CookieClaimsIssuer = "grandnode";
     _config.CookiePrefix       = ".Grand.";
     _cookieAuthService         = new CookieAuthenticationService(_customerSettings, _customerServiceMock.Object, _genericAttributeService, _httpAccessorMock.Object, _config);
     //For mock HttpContext extension methods like SignOutAsync ,SignInAsync etc..
     _authServiceMock    = new Mock <IAuthenticationService>();
     serviceProviderMock = new Mock <IServiceProvider>();
     serviceProviderMock
     .Setup(_ => _.GetService(typeof(IAuthenticationService)))
     .Returns(_authServiceMock.Object);
     _httpContext = new DefaultHttpContext()
     {
         RequestServices = serviceProviderMock.Object
     };
     _httpAccessorMock.Setup(c => c.HttpContext).Returns(_httpContext);
 }
 public HeaderViewComponent(CookieAuthenticationService authenticationService)
 {
     _authenticationService = authenticationService;
 }
Ejemplo n.º 4
0
 public AuthController(OnlineShopContext context, ISmsService smsService, CookieAuthenticationService userService)
 {
     this.context     = context;
     this.smsService  = smsService;
     this.userService = userService;
 }
 public UserController(CookieAuthenticationService authenticationService, DataContext dataContext)
 {
     _authenticationService = authenticationService;
     _dataContext           = dataContext;
 }