/// <summary> /// Creates a screen shot with the file name if the two strings are not equal. /// </summary> /// <param name="expected">The expected string.</param> /// <param name="actual">The actual string.</param> /// <param name="screenShotFileName">The file name for the screen shot.</param> public void AssertStringsAreEqual(string expected, string actual, string screenShotFileName) { if (!expected.Equals(actual)) { if (File.Exists(Path.Combine(ScreenShotPartialPath, screenShotFileName))) { File.Delete(Path.Combine(ScreenShotPartialPath, screenShotFileName)); } IeInstance.CaptureWebPageToFile(Path.Combine(ScreenShotPartialPath, screenShotFileName)); AppendToHtml(screenShotFileName, ScreenShotPartialPath); } Assert.AreEqual(expected, actual); }
/// <summary> /// Creates a screen shot with the file name if check evaluates to true. /// </summary> /// <param name="check">The condition to assert.</param> /// <param name="screenShotFileName">The file name for the screen shot.</param> /// <param name="message">The error message that will be displayed in the test report.</param> public void AssertIsFalse(bool check, string screenShotFileName, string message) { if (check) { if (File.Exists(Path.Combine(ScreenShotPartialPath, screenShotFileName))) { File.Delete(Path.Combine(ScreenShotPartialPath, screenShotFileName)); } IeInstance.CaptureWebPageToFile(Path.Combine(ScreenShotPartialPath, screenShotFileName)); AppendToHtml(screenShotFileName, ScreenShotPartialPath); } Assert.IsFalse(check, message); }
/// <summary> /// Creates a screen shot with the given file name if check evaluates to false. /// </summary> /// <param name="check">The condition to assert.</param> /// <param name="screenShotFileName">The file name for the screen shot.</param> public void AssertIsTrue(bool check, string screenShotFileName) { if (!check) { if (File.Exists(Path.Combine(ScreenShotPartialPath, screenShotFileName))) { File.Delete(Path.Combine(ScreenShotPartialPath, screenShotFileName)); } System.Threading.Thread.Sleep(1500); IeInstance.CaptureWebPageToFile(Path.Combine(ScreenShotPartialPath, screenShotFileName)); AppendToHtml(screenShotFileName, ScreenShotPartialPath); } Assert.IsTrue(check); }