Exemplo n.º 1
0
        public InvoiceForm(Room room, MainView mv)
        {
            if (mv.mm.customer != null)
            {
                this.customer = mv.mm.customer;
                GetCustomernr();
            }
            InitializeComponent();
            this.room = room;

            using (var mc = new MyContext())
            {
                // getting used subtheme
                this.selected = DatabaseController.getLastSubTheme();
            }

            // Sets date and gives a unique InvoiceLabel.
            dateInvoiceDateLabel.Text  = DateTime.Now.ToShortDateString();
            intInvoiceNumberLabel.Text = (DatabaseController.invoiceList.Count + 1).ToString();
            this.representative        = DatabaseController.representativeList.First();
            ic = new InvoiceController(invoiceListPanel1, room.productList);

            ic.FillDisplayedProductList();
            intInvoiceTotalPriceLabelprijsLabel.Text = ic.totalPrice.ToString();
        }
Exemplo n.º 2
0
        public void FillDisplayedProductList_FillingInvoiceForm_RetrievesNonDoubleProducts()
        {
            // Arrange
            Chair doublechair  = new Chair("Hünke Tünke", "Een leren stoel", 30, 30, 49.99, "unitTestImage.bmp");
            Chair doublechair2 = new Chair("Hünke Tünke", "Een leren stoel", 30, 30, 49.99, "unitTestImage.bmp");

            doublechair.productId  = 9;
            doublechair2.productId = 9;

            List <Product> productList = new List <Product> {
                doublechair,
                new Sofa("Hanke hunke", "Een gele bank", 40, 80, 79.99, "unitTestImage.bmp"),
                doublechair
            };
            InvoiceListPanel  ilp = new InvoiceListPanel();
            InvoiceController ic  = new InvoiceController(ilp, productList);

            // Act
            ic.FillDisplayedProductList();

            // Assert
            Assert.AreEqual(2, ic.productPanelList.Count);
        }