public void GetProducts_Exists() { var model = new PricingModel(); model.GetProducts(); Assert.IsNotNull(model.PricingProductsList); Assert.IsNotNull(model.SelectedProductIds); Assert.IsTrue(model.PricingProductsList.Any()); }
public ActionResult Index(PricingModel model) { try { if (model.Save()) return RedirectToAction("Index"); } catch (Exception ex) { ViewBag.Message = ex.Message; } return View(model); }
public void SaveTest_False() { var model = new PricingModel { City = "CityName", Country = "CountryName", Email = "EmailString", FirstName = "FirstName", LastName = string.Empty, Line1 = "Line1", Phone = "Phone", Postcode = "Postcode", SelectedProductIds = new[] { "1", "3", "5", "7" } }; var result = model.Save(); Assert.IsFalse(result); }
public ViewResult Index() { var model = new PricingModel(); model.GetProducts(); return View(model); }