コード例 #1
0
        public void SetUp()
        {
            _cashPayment = new CashPayment();
            _nets        = Substitute.ForPartsOf <Nets>();
            _nets.When(x => x.TransferAmount(Arg.Any <int>(), Arg.Any <string>())).DoNotCallBase();
            _nets.TransferAmount(Arg.Any <int>(), Arg.Any <string>()).Returns(false);

            _paymentProviders = new List <IPaymentProvider> {
                _cashPayment, _nets
            };

            _fakePaymentDao        = Substitute.For <IPaymentDao>();
            _fakeReceiptController = Substitute.For <IReceiptController>();
            _fakeCashDrawer        = Substitute.For <ICashDrawer>();
            _fakeCashDrawer.CashChange.Returns(1000);

            _uut = new PaymentController(_paymentProviders, _fakeReceiptController, _fakePaymentDao, _fakeCashDrawer);

            _cashTransaction = new Transaction()
            {
                Description = "noget",
                PaymentType = PaymentType.Cash,
                Price       = 100,
            };

            _netTransaction = new Transaction()
            {
                Description = "noget",
                PaymentType = PaymentType.Nets,
                Price       = 100,
            };
        }
コード例 #2
0
ファイル: OrderService.cs プロジェクト: sahvishal/matrix
 public OrderService(IOrderDetailRepository orderDetailRepository,
                     ICombinedPaymentInstrumentRepository combinedPaymentInstrumentRepository, IPaymentController paymentController)
 {
     _orderDetailRepository = orderDetailRepository;
     _combinedPaymentInstrumentRepository = combinedPaymentInstrumentRepository;
     _paymentController = paymentController;
 }
コード例 #3
0
 public OnlinePaymentController(ITempcartService tempcartService, ICustomerRepository customerRepository, IProspectCustomerService prospectCustomerService
                                , IEligibilityService eligibilityService, IChargeCardRepository chargeCardRepository, IEventSchedulerService eventSchedulerService, IConfigurationSettingRepository configurationSettingRepository
                                , ISettings settings, IValidator <PaymentInstrumentEditModel> paymentValidator, IEventSchedulingSlotService slotService, IAddressService addressService, IStateRepository stateRepository
                                , ICustomerService customerService, IPaymentController paymentController, ICorporateAccountRepository corporateAccountRepository, IEmailNotificationModelsFactory emailNotificationModelsFactory
                                , IEventRepository eventRepository, ICustomerRegistrationService customerRegistrationService, INotifier notifier, ICallQueueCustomerRepository callQueueCustomerRepository, IEventSchedulingSlotService eventSchedulingSlotService, IGiftCertificateService giftCertificateService, IUniqueItemRepository <ProspectCustomer> uniqueItemRepository, IToolTipRepository toolTipRepository
                                )
 {
     _tempcartService         = tempcartService;
     _customerRepository      = customerRepository;
     _prospectCustomerService = prospectCustomerService;
     _eligibilityService      = eligibilityService;
     _chargeCardRepository    = chargeCardRepository;
     _eventSchedulerService   = eventSchedulerService;
     _settings                       = settings;
     _paymentValidator               = paymentValidator;
     _slotService                    = slotService;
     _addressService                 = addressService;
     _stateRepository                = stateRepository;
     _customerService                = customerService;
     _paymentController              = paymentController;
     _corporateAccountRepository     = corporateAccountRepository;
     _emailNotificationModelsFactory = emailNotificationModelsFactory;
     _eventRepository                = eventRepository;
     _customerRegistrationService    = customerRegistrationService;
     _notifier                       = notifier;
     _callQueueCustomerRepository    = callQueueCustomerRepository;
     _eventSchedulingSlotService     = eventSchedulingSlotService;
     _giftCertificateService         = giftCertificateService;
     _configurationSettingRepository = configurationSettingRepository;
     _enableTexting                  = Convert.ToBoolean(configurationSettingRepository.GetConfigurationValue(ConfigurationSettingName.EnableSmsNotification));
     _prospectCustomerRepository     = uniqueItemRepository;
     _toolTipRepository              = toolTipRepository;
 }
コード例 #4
0
        public void SavePaymentSavesPaymentWithOnePaymentInstrument()
        {
            IPaymentController paymentController = IoC.Resolve <PaymentController>();

            var check = new Check
            {
                AccountNumber        = "asdfsadf",
                Amount               = 12.00m,
                BankName             = "Bank Yes",
                CheckDate            = DateTime.Now,
                CheckNumber          = "123",
                Memo                 = "Payment in full",
                PayableTo            = "ABC Company",
                DataRecorderMetaData =
                    new DataRecorderMetaData {
                    DataRecorderCreator = new OrganizationRoleUser(1), DateCreated = DateTime.Now
                }
            };

            var checkPayment = new CheckPayment()
            {
                Amount = check.Amount,
                Check  = check
            };

            var paymentInstruments = new List <PaymentInstrument> {
                checkPayment
            };

            long paymentId = paymentController.SavePayment(paymentInstruments, "should save", 1);

            Assert.Greater(paymentId, 0, "PaymentId must be >= 0");
        }
コード例 #5
0
 public RefundRequestController(IRepository <RefundRequest> repository, ISessionContext sessionContext, ISettings settings, IRefundRequestService refundRequestService, IEventCustomerService eventCustomerService, ILogManager logManager,
                                IPaymentController paymentController, ICustomerRepository customerRepository, IElectronicProductRepository electronicProductRepository, IOrderRepository orderRepository, IEmailNotificationModelsFactory emailNotificationModelsFactory,
                                IOrderController orderController, IChargeCardRepository chargeCardRepository, IOrganizationRoleUserRepository orgRoleUserRepository, IConfigurationSettingRepository configurationSettingRepository, INotifier notifier,
                                IRefundRequestRepository refundRequestRepository, IEventAppointmentCancellationLogRepository eventAppointmentCancellationLogRepository)
 {
     _repository                     = repository;
     _sessionContext                 = sessionContext;
     _isEccEnabled                   = settings.IsEccEnabled;
     _pageSize                       = settings.DefaultPageSizeForReports;
     _refundRequestService           = refundRequestService;
     _eventCustomerService           = eventCustomerService;
     _paymentController              = paymentController;
     _customerRepository             = customerRepository;
     _electronicProductRepository    = electronicProductRepository;
     _orderRepository                = orderRepository;
     _chargeCardRepository           = chargeCardRepository;
     _orderController                = orderController;
     _notifier                       = notifier;
     _configurationSettingRepository = configurationSettingRepository;
     _orgRoleUserRepository          = orgRoleUserRepository;
     _emailNotificationModelsFactory = emailNotificationModelsFactory;
     _logger = logManager.GetLogger <Global>();
     _refundRequestRepository = refundRequestRepository;
     _eventAppointmentCancellationLogRepository = eventAppointmentCancellationLogRepository;
 }
コード例 #6
0
        public void SavePaymentThrowsExceptionWhenEmptyListProvided()
        {
            IPaymentController paymentController = IoC.Resolve <PaymentController>();
            var paymentInstruments = new List <PaymentInstrument>();

            paymentController.SavePayment(paymentInstruments, "shouldn't save", 1);
        }
コード例 #7
0
        public void SavePaymentThrowsExceptionWhenNullListProvided()
        {
            IPaymentController             paymentController  = IoC.Resolve <PaymentController>();
            const List <PaymentInstrument> paymentInstruments = null;

            paymentController.SavePayment(paymentInstruments, "shouldn't save", 1);
        }
コード例 #8
0
 public void Setup()
 {
     _amountToPay       = 100;
     _orderctrl         = Substitute.For <IOrderController>();
     _paymentController = Substitute.For <IPaymentController>();
     _paymentController.ExecuteTransaction(Arg.Any <Transaction>()).Returns(true);
     _paymentControllerFail = Substitute.For <IPaymentController>();
     _paymentControllerFail.ExecuteTransaction(Arg.Any <Transaction>()).Returns(false);
     _productController = Substitute.For <IProductController>();
     _orderctrl.MissingAmount().Returns(_amountToPay);
     _orderControllerMissingNone = Substitute.For <IOrderController>();
     _orderControllerMissingNone.MissingAmount().Returns(0);
     _receiptctrl = Substitute.For <IReceiptController>();
     _trans       = Substitute.For <Transaction>();
     _orderctrl.CurrentOrder.Returns(new SalesOrder());
     _orderControllerMissingNone.CurrentOrder.Returns(new SalesOrder());
     _product     = new Product("Fedt", 100, true);
     _paymentType = PaymentType.Cash;
     _description = "Description";
     _discount    = new Discount
     {
         Description = "Test Discount",
         Id          = 0,
         Percent     = 10
     };
     _uut = new SalesController(_orderctrl, _receiptctrl, _productController, _paymentController);
 }
コード例 #9
0
ファイル: SalesController.cs プロジェクト: KasperSK/TripleA
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="orderController">An implementation of IOrderController.</param>
 /// <param name="receiptController">An implementation of IReceiptController.</param>
 /// <param name="productController">An implementation of IProductController.</param>
 /// <param name="paymentController">An implentation of IPaymenController.</param>
 public SalesController(IOrderController orderController, IReceiptController receiptController,
                        IProductController productController, IPaymentController paymentController)
 {
     _orderController   = orderController;
     _receiptController = receiptController;
     _productController = productController;
     _paymentController = paymentController;
     _logger            = LogFactory.GetLogger(typeof(SalesController));
     _orderController.PropertyChanged += RepeatNotify;
 }
コード例 #10
0
 public EventCustomerService(IEventCustomerRepository eventCustomerRepository, IEventCustomerAggregateFactory eventCustomerAggregateFactory, IEventCustomerRegistrationViewDataRepository eventCustomerRegistrationViewDataRepository,
                             IAppointmentRepository appointmentRepository, IEventCustomerRegistrationViewDataFactory eventCustomerRegistrationViewDataFactory, IPaymentController paymentController, IEventSchedulingSlotService slotService)
 {
     _eventCustomerRepository                     = eventCustomerRepository;
     _appointmentRepository                       = appointmentRepository;
     _eventCustomerAggregateFactory               = eventCustomerAggregateFactory;
     _eventCustomerRegistrationViewDataFactory    = eventCustomerRegistrationViewDataFactory;
     _eventCustomerRegistrationViewDataRepository = eventCustomerRegistrationViewDataRepository;
     _paymentController = paymentController;
     _slotService       = slotService;
 }
コード例 #11
0
 protected void btnSelect_Click(object sender, EventArgs e)
 {
     if (comboboxtype.SelectedItem.Value.ToString() == "1")
     {
         controller = new ApplicantPaymentController();
     }
     else if (comboboxtype.SelectedItem.Value.ToString() == "2")
     {
         controller = new ProviderPaymentController();
     }
     ViewState["controller"] = controller;
 }
コード例 #12
0
 public SmsPaymentService(
     IPaymentController paymentController,
     IDriverPaymentService androidDriverService,
     IOrderParametersProvider orderParametersProvider,
     SmsPaymentFileCache smsPaymentFileCache
     )
 {
     this.paymentController       = paymentController ?? throw new ArgumentNullException(nameof(paymentController));
     this.androidDriverService    = androidDriverService ?? throw new ArgumentNullException(nameof(androidDriverService));
     this.orderParametersProvider = orderParametersProvider ?? throw new ArgumentNullException(nameof(orderParametersProvider));
     this.smsPaymentFileCache     = smsPaymentFileCache ?? throw new ArgumentNullException(nameof(smsPaymentFileCache));
 }
コード例 #13
0
 public SmsPaymentServiceInstanceProvider(
     IPaymentController paymentController,
     IDriverPaymentService driverPaymentService,
     IOrderParametersProvider orderParametersProvider,
     SmsPaymentFileCache smsPaymentFileProdiver
     )
 {
     this.paymentController       = paymentController ?? throw new ArgumentNullException(nameof(paymentController));
     this.driverPaymentService    = driverPaymentService ?? throw new ArgumentNullException(nameof(driverPaymentService));
     this.orderParametersProvider = orderParametersProvider ?? throw new ArgumentNullException(nameof(orderParametersProvider));
     this.smsPaymentFileProdiver  = smsPaymentFileProdiver ?? throw new ArgumentNullException(nameof(smsPaymentFileProdiver));
 }
コード例 #14
0
        public void SetUp()
        {
            _orderLines = new List <OrderLine>();

            _receiptController = Substitute.For <IReceiptController>();
            _productController = Substitute.For <IProductController>();
            _paymentController = Substitute.For <IPaymentController>();
            _orderDao          = Substitute.For <IOrderDao>();
            _orderDao.When(x => x.AddOrderLine(Arg.Any <OrderLine>())).Do(x => _orderLines.Add(x.Arg <OrderLine>()));

            _orderController = new OrderController(_orderDao);
            _salesController = new SalesController(_orderController, _receiptController, _productController, _paymentController);
        }
コード例 #15
0
        public CustomerPaymentService(ISettings settings, IOrderRepository orderRepository, ICustomerRepository customerRepository,
                                      ISessionContext sessionContext, IGiftCertificateService giftCertificateService, IEventSchedulerService eventSchedulerService,
                                      IEventCustomerRepository eventCustomerRepository, IPaymentController paymentController)
        {
            _settings           = settings;
            _orderRepository    = orderRepository;
            _customerRepository = customerRepository;
            _sessionContext     = sessionContext;


            _giftCertificateService  = giftCertificateService;
            _eventSchedulerService   = eventSchedulerService;
            _eventCustomerRepository = eventCustomerRepository;
            _paymentController       = paymentController;
        }
        public void SetUp()
        {
            _receiptController = Substitute.For<IReceiptController>();
            _cashDrawer = Substitute.For<ICashDrawer>();
            _productDao = Substitute.For<IProductDao>();
            _paymentDao = Substitute.For<IPaymentDao>();
            _orderDao = Substitute.For<IOrderDao>();

            var paymentProviders = new List<IPaymentProvider> {new CashPayment()};
            _productController = new ProductController(_productDao);
            _paymentController = new PaymentController(paymentProviders, _receiptController, _paymentDao, _cashDrawer);
            _orderController = new OrderController(_orderDao);
            _salesController = new SalesController(_orderController, _receiptController, _productController,
                _paymentController);
        }
        public void SetUp()
        {
            _orderLines = new List<OrderLine>();

            _receiptController = Substitute.For<IReceiptController>();
            _productController = Substitute.For<IProductController>();
            _cashDrawer = Substitute.For<ICashDrawer>();
            _paymentDao = Substitute.For<IPaymentDao>();
            _orderDao = Substitute.For<IOrderDao>();
            _orderDao.When(x => x.AddOrderLine(Arg.Any<OrderLine>())).Do(x => _orderLines.Add(x.Arg<OrderLine>()));

            var paymentProviders = new List<IPaymentProvider>() { new CashPayment() };
            _paymentController = new PaymentController(paymentProviders, _receiptController, _paymentDao, _cashDrawer);
            _orderController = new OrderController(_orderDao);
            _salesController = new SalesController(_orderController, _receiptController, _productController, _paymentController);
        }
コード例 #18
0
 public SmsPaymentService(
     IPaymentController paymentController,
     ISmsPaymentStatusNotificationReciever smsPaymentStatusNotificationReciever,
     IOrderParametersProvider orderParametersProvider,
     SmsPaymentFileCache smsPaymentFileCache,
     ISmsPaymentDTOFactory smsPaymentDTOFactory,
     ISmsPaymentValidator smsPaymentValidator
     )
 {
     _paymentController = paymentController ?? throw new ArgumentNullException(nameof(paymentController));
     _smsPaymentStatusNotificationReciever = smsPaymentStatusNotificationReciever ?? throw new ArgumentNullException(nameof(smsPaymentStatusNotificationReciever));
     _orderParametersProvider = orderParametersProvider ?? throw new ArgumentNullException(nameof(orderParametersProvider));
     _smsPaymentFileCache     = smsPaymentFileCache ?? throw new ArgumentNullException(nameof(smsPaymentFileCache));
     _smsPaymentDTOFactory    = smsPaymentDTOFactory ?? throw new ArgumentNullException(nameof(smsPaymentDTOFactory));
     _smsPaymentValidator     = smsPaymentValidator ?? throw new ArgumentNullException(nameof(smsPaymentValidator));
 }
コード例 #19
0
 public SmsPaymentServiceInstanceProvider(
     IPaymentController paymentController,
     IDriverPaymentService driverPaymentService,
     ISmsPaymentStatusNotificationReciever smsPaymentStatusNotificationReciever,
     IOrderParametersProvider orderParametersProvider,
     SmsPaymentFileCache smsPaymentFileProdiver,
     ISmsPaymentDTOFactory smsPaymentDTOFactory
     )
 {
     _paymentController    = paymentController ?? throw new ArgumentNullException(nameof(paymentController));
     _driverPaymentService = driverPaymentService ?? throw new ArgumentNullException(nameof(driverPaymentService));
     _smsPaymentStatusNotificationReciever = smsPaymentStatusNotificationReciever ??
                                             throw new ArgumentNullException(nameof(smsPaymentStatusNotificationReciever));
     _orderParametersProvider = orderParametersProvider ?? throw new ArgumentNullException(nameof(orderParametersProvider));
     _smsPaymentFileProdiver  = smsPaymentFileProdiver ?? throw new ArgumentNullException(nameof(smsPaymentFileProdiver));
     _smsPaymentDTOFactory    = smsPaymentDTOFactory ?? throw new ArgumentNullException(nameof(smsPaymentDTOFactory));
 }
コード例 #20
0
 public OrderController(IOrderRepository orderRepository, ICustomerRepository customerRepository, IOrderController orderController, ISessionContext sessionContext, IRefundRequestService refundRequestService,
                        ISettings settings, IPaymentController paymentController, IChargeCardRepository chargeCardRepository, IEventCustomerResultRepository eventCustomerResultRepository,
                        IElectronicProductRepository electronicProductRepository, ICdContentGeneratorTrackingRepository cdContentGeneratorTrackingRepository, IRefundRequestRepository refundRequestRepository)
 {
     _orderRepository                      = orderRepository;
     _customerRepository                   = customerRepository;
     _orderController                      = orderController;
     _sessionContext                       = sessionContext;
     _refundRequestService                 = refundRequestService;
     _settings                             = settings;
     _paymentController                    = paymentController;
     _chargeCardRepository                 = chargeCardRepository;
     _eventCustomerResultRepository        = eventCustomerResultRepository;
     _cdContentGeneratorTrackingRepository = cdContentGeneratorTrackingRepository;
     _electronicProductRepository          = electronicProductRepository;
     _refundRequestRepository              = refundRequestRepository;
 }
コード例 #21
0
        public void SetUp()
        {
            _receiptController = Substitute.For <IReceiptController>();
            _cashDrawer        = Substitute.For <ICashDrawer>();
            _productDao        = Substitute.For <IProductDao>();
            _paymentDao        = Substitute.For <IPaymentDao>();
            _orderDao          = Substitute.For <IOrderDao>();

            var paymentProviders = new List <IPaymentProvider> {
                new CashPayment()
            };

            _productController = new ProductController(_productDao);
            _paymentController = new PaymentController(paymentProviders, _receiptController, _paymentDao, _cashDrawer);
            _orderController   = new OrderController(_orderDao);
            _salesController   = new SalesController(_orderController, _receiptController, _productController,
                                                     _paymentController);
        }
        public void SetUp()
        {
            _orderLines = new List <OrderLine>();

            _receiptController = Substitute.For <IReceiptController>();
            _productController = Substitute.For <IProductController>();
            _cashDrawer        = Substitute.For <ICashDrawer>();
            _paymentDao        = Substitute.For <IPaymentDao>();
            _orderDao          = Substitute.For <IOrderDao>();
            _orderDao.When(x => x.AddOrderLine(Arg.Any <OrderLine>())).Do(x => _orderLines.Add(x.Arg <OrderLine>()));

            var paymentProviders = new List <IPaymentProvider>()
            {
                new CashPayment()
            };

            _paymentController = new PaymentController(paymentProviders, _receiptController, _paymentDao, _cashDrawer);
            _orderController   = new OrderController(_orderDao);
            _salesController   = new SalesController(_orderController, _receiptController, _productController, _paymentController);
        }
コード例 #23
0
 public EventSchedulerService(IEventRepository eventRepository, IAppointmentRepository appointmentRepository, IEventTestRepository eventTestRepository, IEventPackageRepository eventPackageRepository, IEventCustomerSummaryModelFactory eventCustomerSummaryModelFactory,
                              IHostRepository hostRepository, ITempCartRepository tempCartRepository, IOnlineSchedulingDataFactory onlineSchedulingDataFactory, IValidator <SourceCodeApplyEditModel> sourceCodeValidator, ISourceCodeRepository sourceCodeRepository,
                              ICustomerRepository customerRepository, IElectronicProductRepository electronicProductRepository, IShippingOptionRepository shippingOptionRepository, IPaymentController paymentController, IEventCustomerRepository eventCustomerRepository,
                              IShippingController shippingController, IOrderController orderController, IAddressRepository addressRepository, IHospitalPartnerRepository hospitalPartnerRepository, IShippingDetailOrderDetailRepository shipingDetailOrderDetailRepository,
                              IOrganizationRepository organizationRepository, IOrderRepository orderRepository, IRefundRequestRepository refundRequestRepository, IToolTipRepository toolTipRepository, IConfigurationSettingRepository configurationSettingRepository,
                              IEventSchedulingSlotService slotService, IEventSchedulingSlotRepository slotRepository, IEventAppointmentService eventAppointmentService, IEligibilityRepository eligibilityRepository, IChargeCardRepository chargeCardRepository, ICorporateAccountRepository corporateAccountRepository)
 {
     _customerRepository                 = customerRepository;
     _eventRepository                    = eventRepository;
     _appointmentRepository              = appointmentRepository;
     _eventPackageRepository             = eventPackageRepository;
     _eventTestRepository                = eventTestRepository;
     _tempCartRepository                 = tempCartRepository;
     _hostRepository                     = hostRepository;
     _onlineSchedulingDataFactory        = onlineSchedulingDataFactory;
     _sourceCodeValidator                = sourceCodeValidator;
     _sourceCodeRepository               = sourceCodeRepository;
     _eventCustomerSummaryModelFactory   = eventCustomerSummaryModelFactory;
     _productRepository                  = electronicProductRepository;
     _shippingOptionRepository           = shippingOptionRepository;
     _paymentController                  = paymentController;
     _eventCustomerRepository            = eventCustomerRepository;
     _shippingController                 = shippingController;
     _orderController                    = orderController;
     _shipingDetailOrderDetailRepository = shipingDetailOrderDetailRepository;
     _orderRepository                    = orderRepository;
     _addressRepository                  = addressRepository;
     _hospitalPartnerRepository          = hospitalPartnerRepository;
     _organizationRepository             = organizationRepository;
     _refundRequestRepository            = refundRequestRepository;
     _toolTipRepository                  = toolTipRepository;
     _configurationSettingRepository     = configurationSettingRepository;
     _slotService                = slotService;
     _slotRepository             = slotRepository;
     _eventAppointmentService    = eventAppointmentService;
     _eligibilityRepository      = eligibilityRepository;
     _chargeCardRepository       = chargeCardRepository;
     _corporateAccountRepository = corporateAccountRepository;
 }
コード例 #24
0
        protected void btnAdd_Click(object sender, EventArgs e)
        {
            controller = (IPaymentController)ViewState["controller"];
            var payment = new PaymentViewModel();

            payment.Id          = Guid.NewGuid().ToString();
            payment.BookingId   = id;
            payment.Date        = DateEditPayment.Date;
            payment.Value       = Decimal.Parse(txtValue.Text);
            payment.Title       = comboboxtype.SelectedItem.Text;
            payment.PaymentType = comboboxWayOfPayment.SelectedItem.Text;

            if (controller is ApplicantPaymentController)
            {
                payment.docType = "TravelApplicantPayment";
            }
            else
            {
                payment.docType = "ProviderPayment";
            }
            controller.AddPayment(payment);
            SetModel(payment);
        }
        public void SetUp()
        {
            _raisedEvent = 0;
            _discount    = new Discount();
            _product     = new Product("Test", 100, true);

            _printer    = Substitute.For <IPrinter>();
            _cashDrawer = Substitute.For <ICashDrawer>();
            _dalFacade  = Substitute.For <IDalFacade>();

            _productDao        = new ProductDao(_dalFacade);
            _paymentDao        = new PaymentDao(_dalFacade);
            _orderDao          = new OrderDao(_dalFacade);
            _receiptController = new ReceiptController(_printer);
            _productController = new ProductController(_productDao);
            var paymentProviders = new List <IPaymentProvider> {
                new CashPayment()
            };

            _paymentController = new PaymentController(paymentProviders, _receiptController, _paymentDao, _cashDrawer);
            _orderController   = new OrderController(_orderDao);
            _salesController   = new SalesController(_orderController, _receiptController, _productController,
                                                     _paymentController);
        }
コード例 #26
0
ファイル: SalesController.cs プロジェクト: KasperSK/TripleA
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="orderController">An implementation of IOrderController.</param>
 /// <param name="receiptController">An implementation of IReceiptController.</param>
 /// <param name="productController">An implementation of IProductController.</param>
 /// <param name="paymentController">An implentation of IPaymenController.</param>
 public SalesController(IOrderController orderController, IReceiptController receiptController,
     IProductController productController, IPaymentController paymentController)
 {
     _orderController = orderController;
     _receiptController = receiptController;
     _productController = productController;
     _paymentController = paymentController;
     _logger = LogFactory.GetLogger(typeof (SalesController));
     _orderController.PropertyChanged += RepeatNotify;
 }
        public void SetUp()
        {
            _raisedEvent = 0;
            _discount = new Discount();
            _product = new Product("Test", 100, true);

            _printer = Substitute.For<IPrinter>();
            _cashDrawer = Substitute.For<ICashDrawer>();
            _dalFacade = Substitute.For<IDalFacade>();

            _productDao = new ProductDao(_dalFacade);
            _paymentDao = new PaymentDao(_dalFacade);
            _orderDao = new OrderDao(_dalFacade);
            _receiptController = new ReceiptController(_printer);
            _productController = new ProductController(_productDao);
            var paymentProviders = new List<IPaymentProvider> { new CashPayment() };
            _paymentController = new PaymentController(paymentProviders, _receiptController, _paymentDao, _cashDrawer);
            _orderController = new OrderController(_orderDao);
            _salesController = new SalesController(_orderController, _receiptController, _productController,
                _paymentController);
        }
コード例 #28
0
        public void SetUp()
        {
            _orderLines = new List<OrderLine>();

            _receiptController = Substitute.For<IReceiptController>();
            _productController = Substitute.For<IProductController>();
            _paymentController = Substitute.For<IPaymentController>();
            _orderDao = Substitute.For<IOrderDao>();
            _orderDao.When(x => x.AddOrderLine(Arg.Any<OrderLine>())).Do(x => _orderLines.Add(x.Arg<OrderLine>()));

            _orderController = new OrderController(_orderDao);
            _salesController = new SalesController(_orderController, _receiptController, _productController, _paymentController);
        }
コード例 #29
0
        public void SetUp()
        {
            _cashPayment = new CashPayment();
            _nets = Substitute.ForPartsOf<Nets>();
            _nets.When(x => x.TransferAmount(Arg.Any<int>(), Arg.Any<string>())).DoNotCallBase();
            _nets.TransferAmount(Arg.Any<int>(), Arg.Any<string>()).Returns(false);

            _paymentProviders = new List<IPaymentProvider> {_cashPayment, _nets};

            _fakePaymentDao = Substitute.For<IPaymentDao>();
            _fakeReceiptController = Substitute.For<IReceiptController>();
            _fakeCashDrawer = Substitute.For<ICashDrawer>();
            _fakeCashDrawer.CashChange.Returns(1000);

            _uut = new PaymentController(_paymentProviders, _fakeReceiptController, _fakePaymentDao, _fakeCashDrawer);

            _cashTransaction = new Transaction()
            {

                Description = "noget",
                PaymentType = PaymentType.Cash,
                Price = 100,
            };

            _netTransaction = new Transaction()
            {
                Description = "noget",
                PaymentType = PaymentType.Nets,
                Price = 100,
            };
        }