PageRenderTime 40ms CodeModel.GetById 17ms RepoModel.GetById 1ms app.codeStats 0ms

/V2.2/trunk/Quickstarts/UI Composition/UIComposition.Tests.AcceptanceTest/UIComposition.Tests.AcceptanceTest/TestInfrastructure/TestDataInfrastructure.cs

#
C# | 57 lines | 36 code | 5 blank | 16 comment | 0 complexity | 5d6f2de8640acc5b6849a52e753b3496 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. using System;
  18. using System.Collections.Generic;
  19. using System.Linq;
  20. using System.Text;
  21. using AcceptanceTestLibrary.ApplicationHelper;
  22. namespace UIComposition.Tests.AcceptanceTest.TestInfrastructure
  23. {
  24. public class TestDataInfrastructure
  25. {
  26. public int GetCount<T, TEntity>()
  27. where T : IDataProvider<TEntity>, new()
  28. {
  29. return new T().GetCount();
  30. }
  31. public List<TEntity> GetData<T, TEntity>()
  32. where T : IDataProvider<TEntity>, new()
  33. {
  34. return new T().GetData();
  35. }
  36. public List<TEntity> GetDataForId<T, TEntity>(string id)
  37. where T : IDataProvider<TEntity>, new()
  38. {
  39. return new T().GetDataForId(id);
  40. }
  41. public static string GetTestInputData(string key)
  42. {
  43. ResXConfigHandler testInputHandler = new ResXConfigHandler(ConfigHandler.GetValue("TestDataInputFile"));
  44. return testInputHandler.GetValue(key);
  45. }
  46. public static string GetControlId(string key)
  47. {
  48. ResXConfigHandler testInputHandler = new ResXConfigHandler(ConfigHandler.GetValue("ControlIdentifiersFile"));
  49. return testInputHandler.GetValue(key);
  50. }
  51. }
  52. }