public void RegexTest() { var obj = new RegularExpressionAttrTest() { Country = "uS" }; var res = SwagValidator.Validate(obj); //should throw exception Assert.IsTrue(res); }
public void RegexTestNotValid() { try { var obj = new RegularExpressionAttrTest() { Country = "uX" }; SwagValidator.Validate(obj); //should throw exception Assert.Fail(); // should not reach here because empty string threw exception } catch (Exception ex) { Assert.IsTrue(ex.Message.Contains("Country is invalid")); } }