public void CrushTest() { FormatValidator v1 = new FormatValidator(null); Assert.IsNotNull(v1.FormatItems); Assert.IsFalse(v1.ContainsFormat); Assert.IsTrue(v1.Validate().Result); Assert.IsFalse(FormatValidator.IsFormatString(null)); }
private void ValidateFormat(string format, bool valid = false) { FormatValidator v1 = new FormatValidator(format); Assert.AreEqual(valid, v1.Validate().Result, "'{0}'\n{1}: {2}", format, v1.Validate().ErrorType, v1.Validate().ErrorMessage); }
private void ValidateFormatString(string s) { FormatValidator v = new FormatValidator(s); FormatValidateResult result = v.Validate(); if (!result.Result) { throw new FormatException(String.Format("Invalid sting format: '{0}'\n{1}", s, result.ErrorMessage)); } }