private void ExecuteApplications(OfficeApplicationCache officeApplicationCache, List<ApplicationInfo> applications)
		{
			foreach (ApplicationInfo application in applications)
			{
				officeApplicationCache.Create(application.FileType);

				if (application.ShouldRun)
				{
					OfficeApplicationHelpers.WaitForProcessToStartup(application.Name);
					Assert.IsTrue(OfficeApplicationHelpers.IsProcessRunning(application.Name), string.Format("{0} should be running after a create", application.Name));
				}
				else
				{
					Assert.IsFalse(OfficeApplicationHelpers.IsProcessRunning(application.Name), string.Format("{0} should NOT be running after a create", application.Name));
				}
			}
			officeApplicationCache.StartTimeout();
		}
		public void TestGetHostApplicationForPowerPoint()
		{
			OfficeApplicationHelpers.SetTestSettings(1000, 2000, false, false, true, false, false);

			OfficeApplicationCache officeApplicationCache = new OfficeApplicationCache();
			FileType fileType = OfficeApplicationCache.GetFileTypeBasedOnFilename(CopyFile(Path.Combine(m_testPath, "test.ppt")), true);
			object application = officeApplicationCache.GetHostApplication(fileType);
			Assert.IsNotNull(application);
			try
			{
				Assert.IsInstanceOf(typeof(PowerPoint._Application), application);
			}
			finally
			{
				officeApplicationCache.StartTimeout();
			}
		}
		public void TestRecoverInvalidHostApplicationForPowerPoint()
		{
			OfficeApplicationHelpers.SetTestSettings(1000, 2000, false, false, true, false, false);

			OfficeApplicationCache officeApplicationCache = new OfficeApplicationCache();
			FileType fileType = OfficeApplicationCache.GetFileTypeBasedOnFilename(CopyFile(Path.Combine(m_testPath, "test.ppt")), true);
			object application = officeApplicationCache.GetHostApplication(fileType);
			Assert.IsNotNull(application);
			
			// User kills all word processes
			foreach (Process process in Process.GetProcessesByName("powerpnt"))
			{
				process.Kill();
			}

			application = officeApplicationCache.GetHostApplication(fileType);
			Assert.IsNotNull(application);

			try
			{
				Assert.IsInstanceOf(typeof(PowerPoint._Application), application);
				PowerPoint._Application pptApplication = application as PowerPoint._Application;
				string version = pptApplication.Version;
				Assert.IsFalse(string.IsNullOrEmpty(version));
			}
			finally
			{
				officeApplicationCache.StartTimeout();
			}
		}
		public void TestRecoverInvalidHostApplicationForExcel()
		{
			OfficeApplicationHelpers.SetTestSettings(1000, 2000, false, true, false, false, false);

			OfficeApplicationCache officeApplicationCache = new OfficeApplicationCache();
			FileType fileType = OfficeApplicationCache.GetFileTypeBasedOnFilename(m_testPath + "test.xls", true);
			object application = officeApplicationCache.GetHostApplication(fileType);
			Assert.IsNotNull(application);
			
			// User kills all word processes
			foreach (Process process in Process.GetProcessesByName("excel"))
			{
				process.Kill();
			}

			application = officeApplicationCache.GetHostApplication(fileType);
			Assert.IsNotNull(application);

			try
			{
				Assert.IsInstanceOf(typeof(Excel._Application), application);
				Excel._Application excelApplication = application as Excel._Application;
				string version = excelApplication.Version;
				Assert.IsFalse(string.IsNullOrEmpty(version));
			}
			finally
			{
				officeApplicationCache.StartTimeout();
			}
		}
		public void TestGetHostApplicationForExcel()
		{
			OfficeApplicationHelpers.SetTestSettings(1000, 2000, false, true, false, false, false);

			OfficeApplicationCache officeApplicationCache = new OfficeApplicationCache();
			FileType fileType = OfficeApplicationCache.GetFileTypeBasedOnFilename(m_testPath + "test.xls", true);
			object application = officeApplicationCache.GetHostApplication(fileType);
			Assert.IsNotNull(application);

			try
			{
				Assert.IsInstanceOf(typeof(Excel._Application), application);
			}
			finally
			{
				officeApplicationCache.StartTimeout();
			}
		}
		public void TestRecoverInvalidHostApplicationForWord()
		{
			OfficeApplicationHelpers.SetTestSettings(1000, 2000, true, false, false, false, false);

			OfficeApplicationCache officeApplicationCache = new OfficeApplicationCache();
			FileType fileType = OfficeApplicationCache.GetFileTypeBasedOnFilename(m_testPath + "test.doc", true);
			object application = officeApplicationCache.GetHostApplication(fileType);
			Assert.IsNotNull(application);

			// User kills all word processes
			foreach (Process process in Process.GetProcessesByName("winword"))
			{
				process.Kill();
			}

			System.Threading.Thread.Sleep(50);
			Process[] p = Process.GetProcessesByName("winword");
			int timeout = 100;
			while ((timeout-- > 0) && (p != null) && (p.Length != 0))
			{
				System.Threading.Thread.Sleep(50);
				p = Process.GetProcessesByName("winword");
			}

			OfficeApplicationHelpers.WaitForAllWordInstancesToExit(1000);

			application = officeApplicationCache.GetHostApplication(fileType);
			Assert.IsNotNull(application);

			try
			{
				Assert.IsInstanceOf(typeof(Word._Application), application);
				Word._Application wordApplication = application as Word._Application;
				string version = wordApplication.Version;
				Assert.IsFalse(string.IsNullOrEmpty(version));
			}
			finally
			{
				officeApplicationCache.StartTimeout();
			}
		}
		public void TestOpenPowerPointDocument()
		{
			OfficeApplicationHelpers.SetTestSettings(1000, 2000, false, false, false, false, false);

			OfficeApplicationCache officeApplicationCache = new OfficeApplicationCache();
			object officeDocument = officeApplicationCache.OpenDocument(CopyFile(Path.Combine(m_testPath, "test.ppt")), false);
			Assert.IsNotNull(officeDocument);
			try
			{
				
				if (IsPowerPointVersion11orGreater())
				{
					Assert.IsInstanceOf(typeof(PowerPoint11.Presentation), officeDocument);

				}
				else                
					Assert.IsInstanceOf(typeof(PowerPoint.Presentation), officeDocument);
			}
			finally
			{
				Marshal.ReleaseComObject(officeDocument);
			}
			officeApplicationCache.StartTimeout();
		}
		public void TestOpenExcelDocument()
		{
			OfficeApplicationHelpers.SetTestSettings(1000, 2000, false, false, false, false, false);

			OfficeApplicationCache officeApplicationCache = new OfficeApplicationCache();
			object officeDocument = officeApplicationCache.OpenDocument(m_testPath + "test.xls", false);
			Assert.IsNotNull(officeDocument);
			try
			{
				Assert.IsInstanceOf(typeof(Excel.Workbook), officeDocument);
			}
			finally
			{
				Marshal.ReleaseComObject(officeDocument);
			}
			officeApplicationCache.StartTimeout();
		}