public void TestScreenShotWorksForBrowserStandardDoctypePage() { if (_browserType == BrowserType.Safari) Assert.Ignore("This test is irrelevant for Safari"); string screenshot = String.Empty; try { ErrorSnapShot test = new ErrorSnapShot(GetBrowserObject(), _browserType); screenshot = test.CaptureBrowser(@"C:\SWAT\trunk\SWAT.Tests\TestPages\", "FakeCommand", GetContentHandle(GetBrowserObject())); Assert.IsTrue(File.Exists(screenshot.Substring(22)), "Browser screenshot was not created."); } finally { // Clean up if(!String.IsNullOrEmpty(screenshot)) File.Delete(screenshot.Substring(22)); } }
public void TestNonUiCommandList() { ErrorSnapShot screen = new ErrorSnapShot(); HashSet<string> nonUiCommands = ReflectionHelper.GetField<HashSet<string>>(screen, "NonUiCommands"); if (nonUiCommands == null) throw new NullReferenceException( "NonUiCommands is null which means it is missing from the ErrorSnapshot class."); Assert.IsTrue(nonUiCommands.Count >= 44, "nonUiCommands does not contain all the excluded non ui commands"); Type t = typeof (DataAccess.MSSql); MethodInfo[] methods = t.GetMethods(); foreach (MethodInfo methodInfo in methods) Assert.IsTrue(nonUiCommands.Contains(methodInfo.Name.ToLower()), string.Format("NonUiCommands is missing method {0}", methodInfo.Name)); }