PageRenderTime 18ms CodeModel.GetById 8ms app.highlight 5ms RepoModel.GetById 2ms app.codeStats 0ms

/V1/trunk/Source/QuickStarts/Modularity/Modularity.Tests.AcceptanceTests/AutomatedTests/DirectoryLookupModularity/DirectoryLookupModularityFixture.cs

#
C# | 95 lines | 55 code | 7 blank | 33 comment | 2 complexity | 9a162f342a3c5443675a7687e07454b6 MD5 | raw file
 1//===============================================================================
 2// Microsoft patterns & practices
 3// Composite Application Guidance for Windows Presentation Foundation
 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
18using System;
19using System.Collections.Generic;
20using System.Linq;
21using System.Text;
22using Modularity.AcceptanceTests.ApplicationObserver;
23using Microsoft.VisualStudio.TestTools.UnitTesting;
24using Modularity.AcceptanceTests.Helpers;
25using Core.UIItems.Finders;
26using Core.UIItems;
27using Modularity.AcceptanceTests.TestInfrastructure;
28
29namespace Modularity.AcceptanceTests.AutomatedTests
30{
31    [TestClass]
32    [DeploymentItem(@".\DirectoryLookupModularity\DirectoryLookupModularity\bin\Debug")]
33    [DeploymentItem(@".\Modularity.Tests.AcceptanceTests\bin\Debug")]
34    public class DirectoryLookupModularityFixture : DirectoryLookupModularityFixtureBase
35    {
36        [TestInitialize()]
37        public void MyTestInitialize()
38        {
39            // Check whether any exception occured during previous application launches. 
40            // If so, fail the test case.
41            if (StateDiagnosis.IsFailed)
42            {
43                Assert.Fail(TestDataInfrastructure.GetTestInputData("ApplicationLoadFailure"));
44            }
45
46            base.TestInitialize();
47        }
48
49        /// <summary>
50        /// TestCleanup performs clean-up activities after each test method execution
51        /// </summary>
52        [TestCleanup()]
53        public void MyTestCleanup()
54        {
55            base.TestCleanup();
56        }
57
58        /// <summary>
59        /// Test the launch of Modularity QS
60        /// 
61        /// Repro Steps:
62        /// 1. Launch the QS application
63        /// 2. Check the controls loaded in the primary window
64        /// 
65        /// Expected Result:
66        /// Check if the modules are loaded in the correct order
67        /// Check if the button is displayed
68        /// </summary>
69        [TestMethod]
70        public void ApplicationLaunch()
71        {
72            // perform Directory Sweep and get all the participating modules
73            List<Module> lm = TestDataInfrastructure.GetData<DirectoryLookupModuleDataProvider, Module>();
74            List<Module> sortedList = lm.SortModulesInLoadOrder();
75            Label moduleContent;
76
77            foreach (Module m in sortedList)
78            {
79                moduleContent = Window.Get<Label>(
80                                   SearchCriteria
81                                       .ByText(TestDataInfrastructure.GetTestInputData(m.ModuleName + TestDataInfrastructure.GetTestInputData("ContentString")))
82                                       .AndControlType(typeof(Label)));
83
84                if (m.AllowsDelayLoading)
85                {
86                    Assert.IsNull(moduleContent);
87                }
88                else
89                {
90                    Assert.IsNotNull(moduleContent);
91                }
92            }
93        }
94    }
95}