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]); }
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); }
private void buttonUpdateProduct_Click(object sender, EventArgs e) { driver.UpdateProduct(); }