public void ValidationShouldFail_IfNoNameIsSupplied() { //arrange using (new CultureContext(new CultureInfo("en"))) { var model = new TaskSummaryViewModel(); var tester = new PropertyValidationHelper <TaskSummaryViewModel>(model); //act var result = tester.ValidateProperty(m => m.Name); //assert Assert.Contains("The Name field is required.", result.Select(r => r.ErrorMessage)); } }
public void ValidationShouldFail_IfNoNumberOfVolunteersRequiredIsSupplied() { //arrange using (new CultureContext(new CultureInfo("en"))) { var model = new TaskSummaryViewModel(); var tester = new PropertyValidationHelper <TaskSummaryViewModel>(model); //act var result = tester.ValidateProperty(m => m.NumberOfVolunteersRequired); //assert Assert.Contains("'Volunteers Required' must be greater than 0", result.Select(r => r.ErrorMessage)); } }
public void ValidationShouldFail_IfNoNumberOfVolunteersRequiredIsSupplied() { //arrange using (new CultureContext(new CultureInfo("en"))) { var model = new TaskSummaryViewModel(); var tester = new PropertyValidationHelper<TaskSummaryViewModel>(model); //act var result = tester.ValidateProperty(m => m.NumberOfVolunteersRequired); //assert Assert.Contains("'Volunteers Required' must be greater than 0", result.Select(r => r.ErrorMessage)); } }
public void ValidationShouldFail_IfNoNameIsSupplied() { //arrange using (new CultureContext(new CultureInfo("en"))) { var model = new TaskSummaryViewModel(); var tester = new PropertyValidationHelper<TaskSummaryViewModel>(model); //act var result = tester.ValidateProperty(m => m.Name); //assert Assert.Contains("The Name field is required.", result.Select(r => r.ErrorMessage)); } }
public void ValidationShouldSucceed_IfNumberOfVolunteersRequiredIs1() { //arrange using (new CultureContext(new CultureInfo("en"))) { var model = new TaskSummaryViewModel { NumberOfVolunteersRequired = 1 }; var tester = new PropertyValidationHelper <TaskSummaryViewModel>(model); //act var result = tester.ValidateProperty(m => m.NumberOfVolunteersRequired); //assert Assert.Empty(result); } }
public void ValidationShouldSucceed_IfNameIsSupplied() { //arrange using (new CultureContext(new CultureInfo("en"))) { var model = new TaskSummaryViewModel { Name = "name" }; var tester = new PropertyValidationHelper <TaskSummaryViewModel>(model); //act var result = tester.ValidateProperty(m => m.Name); //assert Assert.Empty(result); } }
public void ValidationShouldSucceed_IfNameIsSupplied() { //arrange using (new CultureContext(new CultureInfo("en"))) { var model = new TaskSummaryViewModel { Name = "name" }; var tester = new PropertyValidationHelper<TaskSummaryViewModel>(model); //act var result = tester.ValidateProperty(m => m.Name); //assert Assert.Empty(result); } }
public void ValidationShouldSucceed_IfNumberOfVolunteersRequiredIs1() { //arrange using (new CultureContext(new CultureInfo("en"))) { var model = new TaskSummaryViewModel { NumberOfVolunteersRequired = 1 }; var tester = new PropertyValidationHelper<TaskSummaryViewModel>(model); //act var result = tester.ValidateProperty(m => m.NumberOfVolunteersRequired); //assert Assert.Empty(result); } }