示例#1
0
        /// <summary>
        /// Verify group of assets
        /// </summary>
        /// <param name="driverContext">Container for driver</param>
        /// <param name="enableScreenShot">Enable screenshot</param>
        /// <param name="enableSavePageSource">Enable save page source</param>
        /// <param name="myAsserts">Group asserts</param>
        /// <example>How to use it: <code>
        /// Verify.That(
        ///     this.DriverContext,
        ///     true,
        ///     false,
        ///     () => Assert.AreEqual(5 + 7 + 2, forgotPassword.EnterEmail(5, 7, 2)),
        ///     () => Assert.AreEqual("Your e-mail's been sent!", forgotPassword.ClickRetrievePassword));
        /// </code></example>
        public static void That(DriverContext driverContext, bool enableScreenShot, bool enableSavePageSource, params Action[] myAsserts)
        {
            foreach (var myAssert in myAsserts)
            {
                That(driverContext, myAssert, false, false);
            }

            if (!driverContext.VerifyMessages.Count.Equals(0) && enableScreenShot)
            {
                driverContext.TakeAndSaveScreenshot();
            }

            if (!driverContext.VerifyMessages.Count.Equals(0) && enableSavePageSource)
            {
                driverContext.SavePageSource(driverContext.TestTitle);
            }
        }
示例#2
0
        public static void That(DriverContext driverContext, Action myAssert, bool enableScreenShot, bool enableSavePageSource)
        {
            try
            {
                myAssert();
            }
            catch (Exception e)
            {
                if (enableScreenShot)
                {
                    driverContext.TakeAndSaveScreenshot();
                }

                if (enableSavePageSource)
                {
                    driverContext.SavePageSource(driverContext.TestTitle);
                }

                driverContext.VerifyMessages.Add(new ErrorDetail(null, DateTime.Now, e));

                Logger.Error(CultureInfo.CurrentCulture, "<VERIFY FAILS>\n{0}\n</VERIFY FAILS>", e);
            }
        }
示例#3
0
 /// <summary>
 /// Save Page Source
 /// </summary>
 /// <param name="driverContext">
 /// Driver context includes
 /// </param>
 /// <returns>Path to the page source</returns>
 public string SavePageSource(DriverContext driverContext)
 {
     return(driverContext.SavePageSource(driverContext.TestTitle));
 }