public void BadModel()
 {
     var model = new CalculatorViewModel() { Expression = new string('1', 201) };
     var context = new ValidationContext(model, null, null);
     var results = new List<ValidationResult>();
     var isModelStateValid = Validator.TryValidateObject(model, context, results, true);
     Assert.IsFalse(isModelStateValid);
 }
 public void GoodModel()
 {
     var model = new CalculatorViewModel() { Expression = "123" };
     var context = new ValidationContext(model, null, null);
     var results = new List<ValidationResult>();
     var isModelStateValid = Validator.TryValidateObject(model, context, results, true);
     Assert.IsTrue(isModelStateValid);
 }