Exemple #1
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="salesController">An ISalesController implementation.</param>
 public MainViewModel(ISalesController salesController)
 {
     _salesController = salesController;
     NumpadViewModel  = new NumpadViewModel();
     TabViewModel     = new TabViewModel(salesController, NumpadViewModel);
     SalesViewModel   = new SalesViewModel(salesController);
 }
Exemple #2
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="salesController">An ISalesController implementation.</param>
 public MainViewModel(ISalesController salesController)
 {
     _salesController = salesController;
     NumpadViewModel = new NumpadViewModel();
     TabViewModel = new TabViewModel(salesController, NumpadViewModel);
     SalesViewModel = new SalesViewModel(salesController);
 }
 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);
 }
        public void Setup()
        {
            _fakeSalesController = Substitute.For<ISalesController>();

            _uut = new SalesViewModel(_fakeSalesController);

            _fakeSalesController.PropertyChanged += _uut.OnCurrentOrderChanged;
        }
        public void Setup()
        {
            _fakeSalesController = Substitute.For <ISalesController>();

            _uut = new SalesViewModel(_fakeSalesController);

            _fakeSalesController.PropertyChanged += _uut.OnCurrentOrderChanged;
        }
        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);
        }
Exemple #7
0
        public void SetUp()
        {
            _testProducts        = new MakeProducts();
            _fakeSalesController = Substitute.For <ISalesController>();
            _fakeNumpad          = Substitute.For <INumpad>();
            _uut            = new TabViewModel(_fakeSalesController, _fakeNumpad);
            _fakeNotifyTest = Substitute.For <INotifyTest>();


            _testProducts.AddProductTab(true, "Red", 1, "RedStuff", 1);
            _testProducts.AddProductType("Red", 1, 20, "RedSnask", 1);
            _testProducts.AddProductGroup("RedHat", 2, 1, 1);
            _testProducts.AddProduct("GreenAle", 20, true, 1, 1, 2);
        }
Exemple #8
0
        public ChargedForm()
        {
            // initializing bussines layer components
            userController = new SalesController();
            _activeUser    = userController.GetUser();
            InitializeComponent();

            AnimationUtil.Animator = animSlider;
            AnimationUtil.SlidedControls.Add(ctrlSettings);
            AnimationUtil.SlidedControls.Add(ctrlReports);

            MenuUtil.InitializeMenuItems(_activeUser, lblMenuAvatarName, lblMenuDepartmentInfo, lblMenuRoleInfo,
                                         pboxAvatar);
        }
        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);
        }
Exemple #11
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);
        }
        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);
        }
Exemple #14
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="salesController">An implementation of ISalesController.</param>
 /// <param name="numpad">An implementation of INumpad.</param>
 public TabViewModel(ISalesController salesController, INumpad numpad)
 {
     _salesController = salesController;
     _numpad          = numpad;
     FetchView();
 }
Exemple #15
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="salesController">An implementation of ISalesController.</param>
 public SalesViewModel(ISalesController salesController)
 {
     _salesController = salesController;
     _salesController.PropertyChanged += OnCurrentOrderChanged;
 }
Exemple #16
0
 // Set userController informations and start the controller UI
 public void SetAuthorization(ISalesController userController)
 {
     this.userController = userController;
     InitializeDetails();
 }
Exemple #17
0
 public void SetUp()
 {
     _salesController = Substitute.For <ISalesController>();
 }
Exemple #18
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="salesController">An implementation of ISalesController.</param>
 /// <param name="numpad">An implementation of INumpad.</param>
 public TabViewModel(ISalesController salesController, INumpad numpad)
 {
     _salesController = salesController;
     _numpad = numpad;
     FetchView();
 }
 public void SetUp()
 {
     _salesController = Substitute.For<ISalesController>();
 }
        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);
        }
        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);
        }
Exemple #22
0
 public ConsoleSalesUI(ISalesController controller)
 {
     this.controller = controller;
 }
Exemple #23
0
        public void SetUp()
        {
            _testProducts = new MakeProducts();
            _fakeSalesController = Substitute.For<ISalesController>();
            _fakeNumpad = Substitute.For<INumpad>();
            _uut = new TabViewModel(_fakeSalesController, _fakeNumpad);
            _fakeNotifyTest = Substitute.For<INotifyTest>();

            _testProducts.AddProductTab(true, "Red", 1, "RedStuff", 1);
            _testProducts.AddProductType("Red", 1, 20, "RedSnask", 1);
            _testProducts.AddProductGroup("RedHat", 2, 1, 1);
            _testProducts.AddProduct("GreenAle", 20, true, 1, 1, 2);
        }