PageRenderTime 20ms CodeModel.GetById 13ms app.highlight 3ms RepoModel.GetById 1ms app.codeStats 0ms

/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//===================================================================================
 33using Microsoft.VisualStudio.TestTools.UnitTesting;
 34using AcceptanceTestLibrary.Common.Desktop;
 35using EventAggregation.Tests.AcceptanceTest.TestEntities.Page;
 36using AcceptanceTestLibrary.Common;
 37using AcceptanceTestLibrary.ApplicationHelper;
 38using EventAggregation.Tests.AcceptanceTest.TestEntities.Assertion;
 39using System.Reflection;
 40using System.Threading;
 41
 42namespace EventAggregation.Tests.AcceptanceTest.Desktop
 43{
 44    /// <summary>
 45    /// Test class for desktop part of EventAggregation
 46    /// </summary>
 47#if DEBUG
 48    [DeploymentItem(@"..\Desktop\bin\Debug", "WPF")]
 49    [DeploymentItem(@".\EventAggregation.Tests.AcceptanceTest\bin\Debug")]
 50#else
 51    [DeploymentItem(@"..\Desktop\bin\Release", "WPF")]
 52    [DeploymentItem(@".\EventAggregation.Tests.AcceptanceTest\bin\Release")]
 53#endif
 54    [TestClass]
 55    public class EventAggregationAcceptanceTestDesktop : FixtureBase<WpfAppLauncher>
 56    {
 57        #region Additional test attributes
 58        [TestInitialize]
 59        public void TestInitialize()
 60        {
 61            string currentOutputPath = (new System.IO.DirectoryInfo(Assembly.GetExecutingAssembly().Location)).Parent.FullName;
 62            EventAggregationPage<WpfAppLauncher>.Window = base.LaunchApplication(currentOutputPath + GetDesktopApplication(), GetDesktopApplicationTitle())[0];
 63            EventAggregationPage<WpfAppLauncher>.Window.SetFocus();            
 64            Thread.Sleep(5000);
 65
 66        }
 67
 68        // Use TestCleanup to run code after each test has run
 69        [TestCleanup()]
 70        public void MyTestCleanup()
 71        {
 72            UnloadApplication();           
 73        }
 74        #endregion
 75
 76        #region Test Methods
 77        [TestMethod]
 78        public void DesktopApplicationLoadTest()
 79        {
 80            //check if window handle object is not null
 81            Assert.IsNotNull(EventAggregationPage<WpfAppLauncher>.Window, "Event Aggregation is not launched.");
 82        }
 83
 84        /// <summary>
 85        /// Check if each if repeated funds are getting added to Activity view
 86        /// /// 
 87        /// Repro Steps:
 88        /// 1. Launch the EventAgrregation QS        
 89        /// 2. For customers customer combo box,  add funds and check if they got added
 90        /// 
 91        /// Expected Result:
 92        /// For the customer the fund should have got added.
 93        [TestMethod]
 94        public void DesktopAddMultipleFundsToCustomer()
 95        {
 96            //Assert AddFund To Customer
 97            EventAggregationAssertion<WpfAppLauncher>.DesktopAssertAddMultipleFundsToCustomer();
 98        }
 99
100        /// <summary>
101        /// Check if each if repeated funds are getting added to Activity view
102        /// /// 
103        /// Repro Steps:
104        /// 1. Launch the EventAgrregation QS        
105        /// 2. For a in the customer combo box,  add same funds repeatedly and check if they got added
106        /// 
107        /// Expected Result:
108        /// For the selected customer fund should got added based on the number of AddButton clicks.
109        /// </summary>
110        [TestMethod]
111        public void DesktopAddRepeatedFundsToCustomer()
112        {
113            //Assert AddFund To Customer
114            EventAggregationAssertion<WpfAppLauncher>.DesktopAssertAddRepeatedFundsToCustomer();
115        }
116
117        /// <summary>
118        /// Check if each of the customer in the customer combo box has an Article view.
119        /// 
120        /// Repro Steps:
121        /// 1. Launch the EventAgrregation QS        
122        /// 2. For every customer in the customer combo box, Check if a corresponding ActivityView is 
123        /// displayed on the right side of the screen.
124        /// 
125        /// Expected Result:
126        /// Every customer in the customer combo box should have a corresponding Article view displayed.      
127        /// </summary>
128        [TestMethod]
129        public void DesktopEachCustomerShouldHaveAnActivityView()
130        {
131            EventAggregationAssertion<WpfAppLauncher>.DesktopAssertEachCustomerShouldHaveAnActivityView();
132        }
133
134        /// <summary>
135        /// Check if the selected fund is added only to the selected customer.
136        /// 
137        /// Repro Steps:
138        /// 1. Launch the EventAggregation QS
139        /// 2. Select the customer from customer dropdown. 
140        /// 3. Select the fund from fund dropdown.
141        /// 4. Click on Add.
142        /// 5. Repeat steps 2 to 4 by changing the customer and fund.
143        /// 5. Check whether the added fund has been displayed correctly in the display area.
144        /// 
145        /// Expected Result:
146        /// Fund should get added to the selected customer.
147        /// </summary>
148        [TestMethod]
149        public void DesktopSelectedFundIsAddedOnlyToTheSelectedCustomer()
150        {
151            EventAggregationAssertion<WpfAppLauncher>.DesktopAssertSelectedFundIsAddedOnlyToTheSelectedCustomer();
152        }
153        #endregion
154
155        #region Private methods
156
157        private static string GetDesktopApplication()
158        {
159            return ConfigHandler.GetValue("WpfAppLocation");
160        }
161
162        private static string GetDesktopApplicationTitle()
163        {
164            return new ResXConfigHandler(ConfigHandler.GetValue("ControlIdentifiersFile")).GetValue("DesktopApplicationTitle");
165        }
166
167        #endregion
168    }
169}