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]); }
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 buttonCreateProduct_Click(object sender, EventArgs e) { driver.AddProduct(); }