public void Should_have_error_when_email_is_null_or_empty() { var model = new NewsletterBoxModel(); model.Email = null; _validator.ShouldHaveValidationErrorFor(x => x.Email, model); model.Email = ""; _validator.ShouldHaveValidationErrorFor(x => x.Email, model); }
public ActionResult NewsletterBox() { if (_customerSettings.HideNewsletterBlock) return Content(""); var model = new NewsletterBoxModel() { AllowToUnsubscribe = _customerSettings.NewsletterBlockAllowToUnsubscribe }; return PartialView(model); }
public ActionResult CampaignRegister() { var model = new Nop.Web.Models.Newsletter.NewsletterBoxModel(); model.Genders = new List <SelectListItem>(); model.Genders.Add(new SelectListItem() { Text = _localizationService.GetResource("Account.Fields.Gender.Female"), Value = "F" }); model.Genders.Add(new SelectListItem() { Text = _localizationService.GetResource("Account.Fields.Gender.Male"), Value = "M" }); model.AvailableCountries = new List <SelectListItem>(); foreach (var c in _countryService.GetAllCountries()) { model.AvailableCountries.Add(new SelectListItem() { Text = c.Name, Value = c.Id.ToString(), Selected = c.DisplayOrder == 1 }); } return(View(model)); }
public void Should_not_have_error_when_email_is_correct_format() { var model = new NewsletterBoxModel(); model.Email = "*****@*****.**"; _validator.ShouldNotHaveValidationErrorFor(x => x.Email, model); }