Ejemplo n.º 1
0
        public void TestGetAllProducts()
        {
            ProductLogic logic = new ProductLogic();

            try
            {
                logic.Create(new ProductBinding {
                    Name = "Test1", Price = 10
                });
                logic.Create(new ProductBinding {
                    Name = "Test2", Price = 15
                });

                OrderProductPageDriver driver = new OrderProductPageDriver(new UiContext(new OrderLogic(), logic), new OrderView(), null);

                List <ProductView> list = driver.GetAllProducts();

                Assert.Equal(2, list.Count);
                Assert.Equal("Test1", list[0].Name);
                Assert.Equal(10, list[0].Price);
                Assert.Equal("Test2", list[1].Name);
                Assert.Equal(15, list[1].Price);
            }
            finally
            {
                logic.Delete(null);
            }
        }
Ejemplo n.º 2
0
        public void TestGetAllProductsEmpty()
        {
            OrderProductPageDriver driver = new OrderProductPageDriver(new UiContext(new OrderLogic(), new ProductLogic()), new OrderView(), null);

            List <ProductView> list = driver.GetAllProducts();

            Assert.Empty(list);
        }
Ejemplo n.º 3
0
        private void FormOrderProduct_Load(object sender, EventArgs e)
        {
            ProductView[] array = driver.GetAllProducts().ToArray();
            comboBox.Items.AddRange(array);

            ProductView selected = driver.GetSelectedProduct();

            if (selected != null)
            {
                foreach (ProductView product in array)
                {
                    if (product.Name == selected.Name)
                    {
                        comboBox.SelectedItem = product;
                        break;
                    }
                }
            }

            textBox.Text = driver.GetCount().ToString();
        }