/// <summary></summary> /// <param name="text"></param> /// <param name="value"></param> /// <param name="failmessage"></param> /// <returns></returns> public string Contains(string text, string value, string failmessage = null) { if (text.Contains(value)) return "OK"; return String.IsNullOrEmpty(failmessage) ? "KO, Verify.Contains failed! txt=<" + Utils.Truncate(text) + "> val=<" + value + ">" : failmessage; }
/// <summary>Test that two objects are not equal and raise an exception if the result is false</summary> /// <param name="expected">expected object. Can be a string, number, array...</param> /// <param name="current">current object. Can be a string, number, array...</param> /// <param name="failmessage">Message to return if the verification fails...</param> public string NotEquals(Object expected, Object current, string failmessage = null) { if (Utils.ObjectEquals(expected, current)) return String.IsNullOrEmpty(failmessage) ? "KO, Verify.NotEquals failed! exp=<" + Utils.Truncate(Utils.ToStrings(expected)) + "> got=<" + Utils.Truncate(Utils.ToStrings(current)) + ">" : failmessage; return "OK"; }
/// <summary></summary> /// <param name="text"></param> /// <param name="pattern"></param> /// <param name="failmessage"></param> /// <returns></returns> public string NotMatches(string text, string pattern, string failmessage = null) { if (Regex.IsMatch(text, pattern)) return String.IsNullOrEmpty(failmessage) ? "KO, Verify.NotMatches failed! txt=<" + Utils.Truncate(text) + "> pat=<" + pattern + ">" : failmessage; return "OK"; }