/// <summary> /// The assert pass. /// </summary> /// <param name="testStep"> /// The test step. /// </param> /// <param name="message"> /// The Message. /// </param> /// <returns> /// The <see cref="bool"/>. /// </returns> private bool AssertPass(string testStep, string message) { AssertLogger.LogPass(testStep, message); Stats.AssertPassCount++; return(true); }
/// <summary> /// The string contains. /// </summary> /// <param name="testStep"> /// The test step. /// </param> /// <param name="value"> /// The value. /// </param> /// <param name="substring"> /// The substring. /// </param> /// <returns> /// The <see cref="bool"/>. /// </returns> public bool StringContains(string testStep, string value, string substring) { var retVal = WrapperStringAsserts(StringAssertFunction.Contains, value, substring); if (retVal == null) { var message = string.Format("[{0}] contains [{1}]", value, substring); AssertLogger.LogPass(testStep, message); } else { AssertLogger.LogFail(testStep, retVal); } return(retVal == null); }
/// <summary> /// The string does not match. /// </summary> /// <param name="testStep"> /// The test step. /// </param> /// <param name="value"> /// The value. /// </param> /// <param name="pattern"> /// The pattern. /// </param> /// <returns> /// The <see cref="bool"/>. /// </returns> public bool StringDoesNotMatch(string testStep, string value, string pattern) { var retVal = WrapperStringAsserts(StringAssertFunction.DoesNotMatch, value, pattern); if (retVal == null) { var message = string.Format("[{0}] is not matched by [{1}]", value, pattern); AssertLogger.LogPass(testStep, message); } else { AssertLogger.LogFail(testStep, retVal); } return(retVal == null); }
/// <summary> /// Asserts that a string is Not (Null or Empty) /// </summary> /// <param name="testStep"> /// Name of the test step in the test script /// </param> /// <param name="actual"> /// Value that was actually experienced /// </param> /// <returns> /// The <see cref="bool"/>. /// </returns> public bool StringNotEmpty(string testStep, string actual) { var retVal = !string.IsNullOrEmpty(actual); if (retVal) { var message = string.Format("String is not NullOrEmpty"); AssertLogger.LogPass(testStep, message); } else { var message = string.Format("[{0}] IS NullOrEmpty", actual); AssertLogger.LogFail(testStep, message); } return(retVal); }
/// <summary> /// Asserts that two values not are equal /// </summary> /// <param name="testStep"> /// Name of the test step in the test script /// </param> /// <param name="expected"> /// Value <c>expected</c> for the assert /// </param> /// <param name="actual"> /// Value that was actually experienced /// </param> /// <returns> /// The <see cref="bool"/>. /// </returns> public bool StringNotEquals(string testStep, string expected, string actual) { bool retVal = expected != actual; if (retVal) { var message = string.Format("[{0}] is NOT equal to [{1}]", expected, actual); AssertLogger.LogPass(testStep, message); } else { var message = string.Format("[{0}] is equal to [{1}]", expected, actual); AssertLogger.LogFail(testStep, message); } return(retVal); }
/// <summary> /// The string does not ends with. /// </summary> /// <param name="testStep"> /// The test step. /// </param> /// <param name="value"> /// The value. /// </param> /// <param name="substring"> /// The substring. /// </param> /// <returns> /// The <see cref="bool"/>. /// </returns> public bool StringDoesNotEndsWith(string testStep, string value, string substring) { var retVal = WrapperStringAsserts(StringAssertFunction.EndsWith, value, substring); if (retVal != null) { var message = string.Format("[{0}] doesn't ends with [{1}]", value, substring); AssertLogger.LogPass(testStep, message); } else { var message = string.Format("[{0}] do ends with [{1}]", value, substring); AssertLogger.LogFail(testStep, message); } return(retVal != null); }