예제 #1
0
        public void TestExceptionMoveToProductPage()
        {
            List <string>      messages = new List <string>();
            ProductsPageDriver driver   = new ProductsPageDriver(new UiContext(new OrderLogic(), new ProductLogic()));

            driver.MoveToProductPage = null;
            driver.ShowErrorMessage  = (msg) => { messages.Add(msg); };

            driver.AddProduct();

            Assert.Equal("Object reference not set to an instance of an object.", messages[0]);
        }
예제 #2
0
        public void TestMethodMoveToProductPage()
        {
            string             message = "";
            ProductsPageDriver driver  = new ProductsPageDriver(new UiContext(new OrderLogic(), new ProductLogic()));

            driver.SelectedProduct   = () => new ProductView();
            driver.MoveToProductPage =
                (context, product) =>
            {
                if (product == null)
                {
                    message += "!";
                }
                else
                {
                    message += "~";
                }
            };

            driver.AddProduct();
            driver.UpdateProduct();

            Assert.Equal("!~", message);
        }
예제 #3
0
 private void buttonCreateProduct_Click(object sender, EventArgs e)
 {
     driver.AddProduct();
 }