protected GarmentShippingDebitNoteController GetController(IGarmentShippingDebitNoteService service, IIdentityProvider identityProvider, IValidateService validateService)
        {
            var claimPrincipal = new Mock <ClaimsPrincipal>();
            var claims         = new Claim[]
            {
                new Claim("username", "unittestusername")
            };

            claimPrincipal.Setup(claim => claim.Claims).Returns(claims);

            var controller = new GarmentShippingDebitNoteController(service, identityProvider, validateService)
            {
                ControllerContext = new ControllerContext()
                {
                    HttpContext = new DefaultHttpContext()
                    {
                        User = claimPrincipal.Object
                    }
                }
            };

            controller.ControllerContext.HttpContext.Request.Headers["Authorization"]     = "Bearer unittesttoken";
            controller.ControllerContext.HttpContext.Request.Headers["x-timezone-offset"] = $"{It.IsAny<int>()}";
            controller.ControllerContext.HttpContext.Request.Path = new PathString("/v1/unit-test");

            return(controller);
        }
Ejemplo n.º 2
0
 public GarmentShippingDebitNoteController(IGarmentShippingDebitNoteService service, IIdentityProvider identityProvider, IValidateService validateService)
 {
     _service          = service;
     _identityProvider = identityProvider;
     _validateService  = validateService;
 }