Example #1
0
 public BillingController(ICostCalculationService costCalculationService, IProductsService productsService, IMapper mapper)
 {
     CostCalculationService = costCalculationService;
     ProductsService        = productsService;
     _mapper = mapper;
 }
Example #2
0
 public PurchaseController(ICostCalculationService costCalcService, ILookupService lookupService)
 {
     _costCalcService = costCalcService;
     _lookupService   = lookupService;
 }
        private CostCalculationController GetController(IIdentityService identityService, IValidateService validateService, ICostCalculationService service)
        {
            var user   = new Mock <ClaimsPrincipal>();
            var claims = new Claim[]
            {
                new Claim("username", "unittestusername")
            };

            user.Setup(u => u.Claims).Returns(claims);
            CostCalculationController controller = (CostCalculationController)Activator.CreateInstance(typeof(CostCalculationController), identityService, validateService, service);

            controller.ControllerContext = new ControllerContext()
            {
                HttpContext = new DefaultHttpContext()
                {
                    User = user.Object
                }
            };
            controller.ControllerContext.HttpContext.Request.Headers["Authorization"] = "Bearer unittesttoken";
            controller.ControllerContext.HttpContext.Request.Path = new PathString("/v1/unit-test");

            return(controller);
        }
Example #4
0
 public CostCalculationController(IIdentityService identityService, IValidateService validateService, ICostCalculationService service)
 {
     _identityService = identityService;
     _validateService = validateService;
     _service         = service;
 }