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