PageRenderTime 30ms CodeModel.GetById 11ms app.highlight 12ms RepoModel.GetById 1ms app.codeStats 0ms

/V2/trunk/Quickstarts/UI Composition/UIComposition.Tests.AcceptanceTest/UIComposition.Tests.AcceptanceTest/ViewInjection/Desktop/ViewInjectionEmployeeModuleDesktopFixture.cs

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