PageRenderTime 44ms CodeModel.GetById 37ms app.highlight 4ms 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//===================================================================================
17using System;
18using System.Collections.Generic;
19using System.Linq;
20using System.Text;
21using AcceptanceTestLibrary.ApplicationHelper;
22
23namespace UIComposition.Tests.AcceptanceTest.TestInfrastructure
24{
25    public class TestDataInfrastructure
26    {
27        public int GetCount<T, TEntity>()
28            where T : IDataProvider<TEntity>, new()
29        {
30            return new T().GetCount();
31        }
32
33        public List<TEntity> GetData<T, TEntity>()
34            where T : IDataProvider<TEntity>, new()
35        {
36            return new T().GetData();
37        }
38
39        public List<TEntity> GetDataForId<T, TEntity>(string id)
40            where T : IDataProvider<TEntity>, new()
41        {
42            return new T().GetDataForId(id);
43        }
44
45        public static string GetTestInputData(string key)
46        {
47            ResXConfigHandler testInputHandler = new ResXConfigHandler(ConfigHandler.GetValue("TestDataInputFile"));
48            return testInputHandler.GetValue(key);
49        }
50
51        public static string GetControlId(string key)
52        {
53            ResXConfigHandler testInputHandler = new ResXConfigHandler(ConfigHandler.GetValue("ControlIdentifiersFile"));
54            return testInputHandler.GetValue(key);
55        }
56    }
57}