PageRenderTime 43ms CodeModel.GetById 17ms RepoModel.GetById 1ms app.codeStats 0ms

/V2/trunk/Quickstarts/UI Composition/UIComposition.Tests.AcceptanceTest/UIComposition.Tests.AcceptanceTest/ViewDiscovery/Desktop/ViewDiscoveryEmployeeModuleDesktopFixture.cs

#
C# | 158 lines | 79 code | 13 blank | 66 comment | 0 complexity | b24bf09982bdba93fc77d4b3d8130e0a MD5 | raw file
  1. //===================================================================================
  2. // Microsoft patterns & practices
  3. // Composite Application Guidance for Windows Presentation Foundation and Silverlight
  4. //===================================================================================
  5. // Copyright (c) Microsoft Corporation. All rights reserved.
  6. // THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY
  7. // OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT
  8. // LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
  9. // FITNESS FOR A PARTICULAR PURPOSE.
  10. //===================================================================================
  11. // The example companies, organizations, products, domain names,
  12. // e-mail addresses, logos, people, places, and events depicted
  13. // herein are fictitious. No association with any real company,
  14. // organization, product, domain name, email address, logo, person,
  15. // places, or events is intended or should be inferred.
  16. //===================================================================================
  17. using System;
  18. using System.Collections.Generic;
  19. using System.Linq;
  20. using System.Text;
  21. using Microsoft.VisualStudio.TestTools.UnitTesting;
  22. using System.Threading;
  23. using Core.UIItems;
  24. using Core.UIItems.TabItems;
  25. using Core.UIItems.Finders;
  26. using AcceptanceTestLibrary.ApplicationObserver;
  27. using AcceptanceTestLibrary.Common;
  28. using AcceptanceTestLibrary.Common.Desktop;
  29. using System.Reflection;
  30. using UIComposition.Tests.AcceptanceTest.TestEntities.Page;
  31. using AcceptanceTestLibrary.ApplicationHelper;
  32. using UIComposition.Tests.AcceptanceTest.TestEntities.Assertion;
  33. namespace UIComposition.Tests.AcceptanceTest.ViewDiscovery.Desktop
  34. {
  35. #if DEBUG
  36. [DeploymentItem(@"..\ViewDiscovery\Desktop\UIComposition\bin\Debug", @"TDWPF")]
  37. [DeploymentItem(@".\UIComposition.Tests.AcceptanceTest\bin\Debug")]
  38. #else
  39. [DeploymentItem(@"..\ViewDiscovery\Desktop\UIComposition\bin\Release", @"TDWPF")]
  40. [DeploymentItem(@".\UIComposition.Tests.AcceptanceTest\bin\Release")]
  41. #endif
  42. [TestClass]
  43. public class ViewDiscoveryEmployeeModuleDesktopFixture : FixtureBase<WpfAppLauncher>
  44. {
  45. [TestInitialize()]
  46. public void MyTestInitialize()
  47. {
  48. string currentOutputPath = (new System.IO.DirectoryInfo(Assembly.GetExecutingAssembly().Location)).Parent.FullName;
  49. UICompositionPage<WpfAppLauncher>.LaunchApplication(currentOutputPath + GetDesktopApplication(), GetDesktopApplicationTitle());
  50. Thread.Sleep(5000);
  51. }
  52. /// <summary>
  53. /// TestCleanup performs clean-up activities after each test method execution
  54. /// </summary>
  55. [TestCleanup()]
  56. public void MyTestCleanup()
  57. {
  58. UICompositionPage<WpfAppLauncher>.DisposeApplication();
  59. }
  60. #region Test Methods
  61. [TestMethod]
  62. public void DesktopViewDiscoveryUILoadTest()
  63. {
  64. //check if window handle object is not null
  65. Assert.IsNotNull(UICompositionPage<WpfAppLauncher>.DesktopWindow, "ViewDiscovery UI composition is not launched.");
  66. }
  67. /// <summary>
  68. /// Validate if the details view of the selected employee are displayed correctly.
  69. ///
  70. /// Repro Steps:
  71. /// 1. Launch the QS application
  72. /// 2. Click on the first employee row in the Employee List table
  73. /// 3. Check if the Details View Tab is displayed, and the number of tab items is 3.
  74. /// 4. Check if the tab items headers match with "General", "Location" and "Current Projects"
  75. ///
  76. /// Expected Result:
  77. /// Details View Tab is dispalyed with 3 tab items.
  78. /// The tab items headers match with "General", "Location" and "Current Projects"
  79. /// </summary>
  80. [TestMethod]
  81. public void DesktopViewDiscoveryValidateEmployeeSelection()
  82. {
  83. UICompositionAssertion<WpfAppLauncher>.AssertEmployeeSelection();
  84. }
  85. /// <summary>
  86. /// Validate General details in the General Tab for selected employee
  87. ///
  88. /// Repro Steps:
  89. /// 1. Launch the QS Application
  90. /// 2. Select the first employee row in the Employee List table
  91. /// 3. Check if the details of the selected employee are displayed in the General tab
  92. ///
  93. /// Expected results:
  94. /// Employee First Name, Last Name, Phone and Email are correctly displayed in the General Tab
  95. /// </summary>
  96. [TestMethod]
  97. public void DesktopViewDiscoveryValidateEmployeeDetailsGeneralSection()
  98. {
  99. UICompositionAssertion<WpfAppLauncher>.AssertEmployeeGeneralData();
  100. }
  101. /// <summary>
  102. /// Validate Location details in the Location Tab for selected employee
  103. ///
  104. /// Repro Steps:
  105. /// 1. Launch the QS Application
  106. /// 2. Select the first employee row in the Employee List table
  107. /// 3. Check if the location details of the selected employee are displayed in the Location tab
  108. ///
  109. /// Expected results:
  110. /// Loaction Tab has a frame with required data
  111. /// </summary>
  112. [TestMethod]
  113. public void DesktopViewDiscoveryValidateEmployeeDetailsLocationSection()
  114. {
  115. UICompositionAssertion<WpfAppLauncher>.AssertEmployeeLocationData();
  116. }
  117. /// <summary>
  118. /// Validate Current Projects details in the Current Projects Tab for selected employee
  119. ///
  120. /// Repro Steps:
  121. /// 1. Launch the QS Application
  122. /// 2. Select the first employee row in the Employee List table
  123. /// 3. Check if the Current Projects of the selected employee are displayed in the Current Projects tab
  124. ///
  125. /// Expected results:
  126. /// Current Project and Role of the selected Employee are correctly displayed in the Current Projects Tab
  127. /// </summary>
  128. [TestMethod]
  129. public void DesktopViewDiscoveryValidateEmployeeDetailsCurrentProjectsSection()
  130. {
  131. UICompositionAssertion<WpfAppLauncher>.AssertEmployeeProjectsData();
  132. }
  133. #endregion
  134. #region Private methods
  135. private static string GetDesktopApplication()
  136. {
  137. return ConfigHandler.GetValue("ViewDiscoveryWpfAppLocation");
  138. }
  139. private static string GetDesktopApplicationTitle()
  140. {
  141. return new ResXConfigHandler(ConfigHandler.GetValue("TestDataInputFile")).GetValue("ViewDiscoveryDesktopApplicationTitle");
  142. }
  143. #endregion
  144. }
  145. }