示例#1
0
        public void TestExceptionSelected()
        {
            List <string>      messages = new List <string>();
            ProductsPageDriver driver   = new ProductsPageDriver(new UiContext(new OrderLogic(), new ProductLogic()));

            driver.SelectedProduct  = () => (new List <ProductView>())[0];
            driver.ShowErrorMessage = (msg) => { messages.Add(msg); };

            driver.UpdateProduct();
            driver.DeleteProduct();

            Assert.Equal("Index was out of range. Must be non-negative and less than the size of the collection. (Parameter 'index')", messages[0]);
            Assert.Equal("Index was out of range. Must be non-negative and less than the size of the collection. (Parameter 'index')", messages[1]);
        }
示例#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 buttonUpdateProduct_Click(object sender, EventArgs e)
 {
     driver.UpdateProduct();
 }