public void TestScreenShotAllScreensIsNotTakenForCommand(String command)
 {
     SWAT.ErrorSnapShot test = new SWAT.ErrorSnapShot();
     string imageSave = test.CaptureAllScreens(@"C:\SWAT\trunk\SWAT.Tests\TestPages\", command);
     //We want to make sure that no file was save.
     Assert.IsTrue(!File.Exists(imageSave.Substring(18)), "File not was created and screen shots is working for non-GUI commands.");
 }
 public void TestScreenShotCaptureAllScreensFailed()
 {
     SWAT.ErrorSnapShot capture = new SWAT.ErrorSnapShot();
     string returnValue = capture.CaptureAllScreens("C:\test", "Any Command"); // this will fail because is not a folder and return an error message.
     Assert.AreEqual(returnValue, "Illegal characters in path.");
 }
 public void TestScreenShotWorksForAllScreens()
 {
     SWAT.ErrorSnapShot test = new SWAT.ErrorSnapShot();
     string imageSave = test.CaptureAllScreens(@"C:\SWAT\trunk\SWAT.Tests\TestPages\", "Test");
     //Want to make sure that the file was saved.
     Assert.IsTrue(File.Exists(imageSave.Substring(22)), imageSave.Substring(18) + "      No file was created and screen shots is not working for all screens.");
     File.Delete(imageSave.Substring(22));
 }
        public virtual string TakeScreenshot(string filePrefix)
        {
            string image = "";

            if (SWAT.ScreenShotSettings.SnapShotOption == true)
            {
                //Handles scenario where SnapShotFolder is set using "DriveLetter:\" instead of "\\MacineName\DriveLetter$\".
                //This occurs if user's SWAT.user.config file originated from an older version of SWAT where the SnapShotFolder
                //setting was not checking and updating the format of the folder's path.
                if (SWAT.ScreenShotSettings.SnapShotFolder.Contains(@":"))
                {
                    //Uses the logic from the SnapShotFolder's set method to correctly format the SnapShotFolder path
                    SWAT.ScreenShotSettings.SnapShotFolder = SWAT.ScreenShotSettings.SnapShotFolder;
                    SWAT.UserConfigHandler.Save();
                }
                if (SWAT.ScreenShotSettings.ScreenShotAllScreens == true)
                {
                    SWAT.ErrorSnapShot capture = new SWAT.ErrorSnapShot();
                    image = capture.CaptureAllScreens(SWAT.ScreenShotSettings.SnapShotFolder, filePrefix);
                }
                if (SWAT.ScreenShotSettings.ScreenShotBrowser == true)
                {
                    try
                    {
                        SWAT.ErrorSnapShot capture = new SWAT.ErrorSnapShot(this as IDocumentInfo, browserType);
                        image = capture.CaptureBrowser(SWAT.ScreenShotSettings.SnapShotFolder, filePrefix, GetContentHandle());
                    }
                    catch
                    {
                        image = "Unable to take picture since no browser and/or document was present.";
                    }
                }
            }
            return image;
        }