PageRenderTime 29ms CodeModel.GetById 17ms app.highlight 6ms RepoModel.GetById 1ms app.codeStats 1ms

/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//===================================================================================
 17using System;
 18using System.Collections.Generic;
 19using System.Linq;
 20using System.Text;
 21using Microsoft.VisualStudio.TestTools.UnitTesting;
 22using System.Threading;
 23using Core.UIItems;
 24using Core.UIItems.TabItems;
 25using Core.UIItems.Finders;
 26using AcceptanceTestLibrary.ApplicationObserver;
 27using AcceptanceTestLibrary.Common;
 28using AcceptanceTestLibrary.Common.Desktop;
 29using System.Reflection;
 30using UIComposition.Tests.AcceptanceTest.TestEntities.Page;
 31using AcceptanceTestLibrary.ApplicationHelper;
 32using UIComposition.Tests.AcceptanceTest.TestEntities.Assertion;
 33
 34namespace UIComposition.Tests.AcceptanceTest.ViewDiscovery.Desktop
 35{
 36#if DEBUG
 37    [DeploymentItem(@"..\ViewDiscovery\Desktop\UIComposition\bin\Debug", @"TDWPF")]
 38    [DeploymentItem(@".\UIComposition.Tests.AcceptanceTest\bin\Debug")]
 39#else
 40    [DeploymentItem(@"..\ViewDiscovery\Desktop\UIComposition\bin\Release", @"TDWPF")]
 41    [DeploymentItem(@".\UIComposition.Tests.AcceptanceTest\bin\Release")]
 42#endif
 43    
 44    [TestClass]
 45    public class ViewDiscoveryEmployeeModuleDesktopFixture : FixtureBase<WpfAppLauncher>
 46    {
 47        [TestInitialize()]
 48        public void MyTestInitialize()
 49        {
 50            string currentOutputPath = (new System.IO.DirectoryInfo(Assembly.GetExecutingAssembly().Location)).Parent.FullName;
 51            UICompositionPage<WpfAppLauncher>.LaunchApplication(currentOutputPath + GetDesktopApplication(), GetDesktopApplicationTitle());
 52            Thread.Sleep(5000);
 53        }
 54
 55        /// <summary>
 56        /// TestCleanup performs clean-up activities after each test method execution
 57        /// </summary>
 58        [TestCleanup()]
 59        public void MyTestCleanup()
 60        {
 61            UICompositionPage<WpfAppLauncher>.DisposeApplication();
 62        }
 63
 64        #region Test Methods
 65        [TestMethod]
 66        public void DesktopViewDiscoveryUILoadTest()
 67        {
 68            //check if window handle object is not null
 69            Assert.IsNotNull(UICompositionPage<WpfAppLauncher>.DesktopWindow, "ViewDiscovery UI composition is not launched.");
 70        }
 71
 72        /// <summary>
 73        /// Validate if the details view of the selected employee are displayed correctly.
 74        /// 
 75        /// Repro Steps:
 76        /// 1. Launch the QS application
 77        /// 2. Click on the first employee row in the Employee List table
 78        /// 3. Check if the Details View Tab is displayed, and the number of tab items is 3.
 79        /// 4. Check if the tab items headers match with "General", "Location" and "Current Projects"
 80        /// 
 81        /// Expected Result:
 82        /// Details View Tab is dispalyed with 3 tab items. 
 83        /// The tab items headers match with "General", "Location" and "Current Projects"
 84        /// </summary>
 85        [TestMethod]
 86        public void DesktopViewDiscoveryValidateEmployeeSelection()
 87        {
 88            UICompositionAssertion<WpfAppLauncher>.AssertEmployeeSelection();
 89        }
 90
 91        /// <summary>
 92        /// Validate General details in the General Tab for selected employee
 93        /// 
 94        /// Repro Steps:
 95        /// 1. Launch the QS Application
 96        /// 2. Select the first employee row in the Employee List table
 97        /// 3. Check if the details of the selected employee are displayed in the General tab
 98        /// 
 99        /// Expected results:
100        /// Employee First Name, Last Name, Phone and Email are correctly displayed in the General Tab
101        /// </summary>
102        [TestMethod]
103        public void DesktopViewDiscoveryValidateEmployeeDetailsGeneralSection()
104        {
105            UICompositionAssertion<WpfAppLauncher>.AssertEmployeeGeneralData();
106        }
107
108        /// <summary>
109        /// Validate Location details in the Location Tab for selected employee
110        /// 
111        /// Repro Steps:
112        /// 1. Launch the QS Application
113        /// 2. Select the first employee row in the Employee List table
114        /// 3. Check if the location details of the selected employee are displayed in the Location tab
115        /// 
116        /// Expected results:
117        /// Loaction Tab has a frame with required data
118        /// </summary>
119        [TestMethod]
120        public void DesktopViewDiscoveryValidateEmployeeDetailsLocationSection()
121        {
122            UICompositionAssertion<WpfAppLauncher>.AssertEmployeeLocationData();
123        }
124
125        /// <summary>
126        /// Validate Current Projects details in the Current Projects Tab for selected employee
127        /// 
128        /// Repro Steps:
129        /// 1. Launch the QS Application
130        /// 2. Select the first employee row in the Employee List table
131        /// 3. Check if the Current Projects of the selected employee are displayed in the Current Projects tab
132        /// 
133        /// Expected results:
134        /// Current Project and Role of the selected Employee are correctly displayed in the Current Projects Tab
135        /// </summary>
136        [TestMethod]
137        public void DesktopViewDiscoveryValidateEmployeeDetailsCurrentProjectsSection()
138        {
139            UICompositionAssertion<WpfAppLauncher>.AssertEmployeeProjectsData();
140        }
141        #endregion
142
143        #region Private methods
144
145        private static string GetDesktopApplication()
146        {
147            return ConfigHandler.GetValue("ViewDiscoveryWpfAppLocation");
148        }
149
150        private static string GetDesktopApplicationTitle()
151        {
152            return new ResXConfigHandler(ConfigHandler.GetValue("TestDataInputFile")).GetValue("ViewDiscoveryDesktopApplicationTitle");
153        }
154
155        #endregion
156    }
157
158}