PageRenderTime 45ms CodeModel.GetById 18ms RepoModel.GetById 0ms app.codeStats 1ms

/V4/Quickstarts/EventAggregation/EventAggregation.Tests.AcceptanceTest/EventAggregation.Tests.AcceptanceTest/Desktop/EventAggregationAcceptanceTestDesktop.cs

#
C# | 169 lines | 74 code | 12 blank | 83 comment | 0 complexity | bc7100a312fbf8bb2c3e3f882de15b61 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. //===================================================================================
  18. // Microsoft patterns & practices
  19. // Composite Application Guidance for Windows Presentation Foundation and Silverlight
  20. //===================================================================================
  21. // Copyright (c) Microsoft Corporation. All rights reserved.
  22. // THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY
  23. // OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT
  24. // LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
  25. // FITNESS FOR A PARTICULAR PURPOSE.
  26. //===================================================================================
  27. // The example companies, organizations, products, domain names,
  28. // e-mail addresses, logos, people, places, and events depicted
  29. // herein are fictitious. No association with any real company,
  30. // organization, product, domain name, email address, logo, person,
  31. // places, or events is intended or should be inferred.
  32. //===================================================================================
  33. using Microsoft.VisualStudio.TestTools.UnitTesting;
  34. using AcceptanceTestLibrary.Common.Desktop;
  35. using EventAggregation.Tests.AcceptanceTest.TestEntities.Page;
  36. using AcceptanceTestLibrary.Common;
  37. using AcceptanceTestLibrary.ApplicationHelper;
  38. using EventAggregation.Tests.AcceptanceTest.TestEntities.Assertion;
  39. using System.Reflection;
  40. using System.Threading;
  41. namespace EventAggregation.Tests.AcceptanceTest.Desktop
  42. {
  43. /// <summary>
  44. /// Test class for desktop part of EventAggregation
  45. /// </summary>
  46. #if DEBUG
  47. [DeploymentItem(@"..\Desktop\bin\Debug", "WPF")]
  48. [DeploymentItem(@".\EventAggregation.Tests.AcceptanceTest\bin\Debug")]
  49. #else
  50. [DeploymentItem(@"..\Desktop\bin\Release", "WPF")]
  51. [DeploymentItem(@".\EventAggregation.Tests.AcceptanceTest\bin\Release")]
  52. #endif
  53. [TestClass]
  54. public class EventAggregationAcceptanceTestDesktop : FixtureBase<WpfAppLauncher>
  55. {
  56. #region Additional test attributes
  57. [TestInitialize]
  58. public void TestInitialize()
  59. {
  60. string currentOutputPath = (new System.IO.DirectoryInfo(Assembly.GetExecutingAssembly().Location)).Parent.FullName;
  61. EventAggregationPage<WpfAppLauncher>.Window = base.LaunchApplication(currentOutputPath + GetDesktopApplication(), GetDesktopApplicationTitle())[0];
  62. EventAggregationPage<WpfAppLauncher>.Window.SetFocus();
  63. Thread.Sleep(5000);
  64. }
  65. // Use TestCleanup to run code after each test has run
  66. [TestCleanup()]
  67. public void MyTestCleanup()
  68. {
  69. UnloadApplication();
  70. }
  71. #endregion
  72. #region Test Methods
  73. [TestMethod]
  74. public void DesktopApplicationLoadTest()
  75. {
  76. //check if window handle object is not null
  77. Assert.IsNotNull(EventAggregationPage<WpfAppLauncher>.Window, "Event Aggregation is not launched.");
  78. }
  79. /// <summary>
  80. /// Check if each if repeated funds are getting added to Activity view
  81. /// ///
  82. /// Repro Steps:
  83. /// 1. Launch the EventAgrregation QS
  84. /// 2. For customers customer combo box, add funds and check if they got added
  85. ///
  86. /// Expected Result:
  87. /// For the customer the fund should have got added.
  88. [TestMethod]
  89. public void DesktopAddMultipleFundsToCustomer()
  90. {
  91. //Assert AddFund To Customer
  92. EventAggregationAssertion<WpfAppLauncher>.DesktopAssertAddMultipleFundsToCustomer();
  93. }
  94. /// <summary>
  95. /// Check if each if repeated funds are getting added to Activity view
  96. /// ///
  97. /// Repro Steps:
  98. /// 1. Launch the EventAgrregation QS
  99. /// 2. For a in the customer combo box, add same funds repeatedly and check if they got added
  100. ///
  101. /// Expected Result:
  102. /// For the selected customer fund should got added based on the number of AddButton clicks.
  103. /// </summary>
  104. [TestMethod]
  105. public void DesktopAddRepeatedFundsToCustomer()
  106. {
  107. //Assert AddFund To Customer
  108. EventAggregationAssertion<WpfAppLauncher>.DesktopAssertAddRepeatedFundsToCustomer();
  109. }
  110. /// <summary>
  111. /// Check if each of the customer in the customer combo box has an Article view.
  112. ///
  113. /// Repro Steps:
  114. /// 1. Launch the EventAgrregation QS
  115. /// 2. For every customer in the customer combo box, Check if a corresponding ActivityView is
  116. /// displayed on the right side of the screen.
  117. ///
  118. /// Expected Result:
  119. /// Every customer in the customer combo box should have a corresponding Article view displayed.
  120. /// </summary>
  121. [TestMethod]
  122. public void DesktopEachCustomerShouldHaveAnActivityView()
  123. {
  124. EventAggregationAssertion<WpfAppLauncher>.DesktopAssertEachCustomerShouldHaveAnActivityView();
  125. }
  126. /// <summary>
  127. /// Check if the selected fund is added only to the selected customer.
  128. ///
  129. /// Repro Steps:
  130. /// 1. Launch the EventAggregation QS
  131. /// 2. Select the customer from customer dropdown.
  132. /// 3. Select the fund from fund dropdown.
  133. /// 4. Click on Add.
  134. /// 5. Repeat steps 2 to 4 by changing the customer and fund.
  135. /// 5. Check whether the added fund has been displayed correctly in the display area.
  136. ///
  137. /// Expected Result:
  138. /// Fund should get added to the selected customer.
  139. /// </summary>
  140. [TestMethod]
  141. public void DesktopSelectedFundIsAddedOnlyToTheSelectedCustomer()
  142. {
  143. EventAggregationAssertion<WpfAppLauncher>.DesktopAssertSelectedFundIsAddedOnlyToTheSelectedCustomer();
  144. }
  145. #endregion
  146. #region Private methods
  147. private static string GetDesktopApplication()
  148. {
  149. return ConfigHandler.GetValue("WpfAppLocation");
  150. }
  151. private static string GetDesktopApplicationTitle()
  152. {
  153. return new ResXConfigHandler(ConfigHandler.GetValue("ControlIdentifiersFile")).GetValue("DesktopApplicationTitle");
  154. }
  155. #endregion
  156. }
  157. }