public void TestGetParametersAndValidate_GoodQuery() { using (var validator = new SqlValidator(_cstr_db)) { IList<SqlError> errors; var Parameters = validator.GetParametersAndValidate("select * from Customer where FirstName = @name;", out errors); Assert.IsNull(errors); Assert.IsTrue(Parameters.Any()); Assert.IsTrue(Parameters.Any(p => p.Name == "@name")); } }
public void TestGetParametersAndValidate_GoodQuery() { using (var validator = new SqlValidator(_cstr_db)) { IList <SqlError> errors; var Parameters = validator.GetParametersAndValidate("select * from Customer where FirstName = @name;", out errors); Assert.IsNull(errors); Assert.IsTrue(Parameters.Any()); Assert.IsTrue(Parameters.Any(p => p.Name == "@name")); } }
public void TestGetParametersAndValidate_BadQuery() { using (var validator = new SqlValidator(_cstr_db)) { IList<SqlError> errors; var Parameters = validator.GetParametersAndValidate("select * from NotARealTable where FirstName = @name;", out errors); Assert.IsNotNull(errors); Assert.AreEqual(errors.Count(), 1); Assert.IsNull(Parameters); foreach (var error in errors) Debug.WriteLine(error); } }
public void TestGetParametersAndValidate_BadQuery() { using (var validator = new SqlValidator(_cstr_db)) { IList <SqlError> errors; var Parameters = validator.GetParametersAndValidate("select * from NotARealTable where FirstName = @name;", out errors); Assert.IsNotNull(errors); Assert.AreEqual(errors.Count(), 1); Assert.IsNull(Parameters); foreach (var error in errors) { Debug.WriteLine(error); } } }