예제 #1
0
        public GetCustomerResponse GetCustomerById(GetCustomerRequest request)
        {
            GetCustomerResponse response = new GetCustomerResponse();
            CustomerBusinessComponent bc = DependencyInjectionHelper.GetCustomerBusinessComponent();

            Customer customer = bc.GetCustomerById(request.CustomerId);
            response.Customer = CustomerAdapter.CustomerToDto(customer);

            return response;
        }
        public void TestGetCustomer()
        {
            int customerId = 1;
            GetCustomerResponse response = new GetCustomerResponse();
            response.Customer = new CustomerDTO() { Id = customerId };

            Expect.Once.On(service).Method("GetCustomerById").Will(Return.Value(response));
            CustomerDTO customer = serviceFacade.GetCustomerById(customerId);
            Assert.AreEqual(customer.Id, customerId);
        }
예제 #3
0
        public GetCustomerResponse GetCustomer()
        {
            if (!HttpContext.Current.User.Identity.IsAuthenticated)
                throw new FaultException<NotAuthenticatedFault>(new NotAuthenticatedFault());
            GetCustomerResponse response = new GetCustomerResponse();
            SecurityBusinessComponent sc = DependencyInjectionHelper.GetSecurityBusinessComponent();
            HsrOrderApp.BL.Security.CustomPrincipal principal = HttpContext.Current.User as CustomPrincipal;
            if (principal == null)
                return response ;
            User user = sc.GetUserById(principal.User.UserId);
            CustomerBusinessComponent bc = DependencyInjectionHelper.GetCustomerBusinessComponent();
            Customer customer = bc.GetCustomerById(user.Customer.CustomerId);
            response.Customer = CustomerAdapter.CustomerToDto(customer);

            return response;
        }