PageRenderTime 24ms CodeModel.GetById 15ms app.highlight 5ms RepoModel.GetById 1ms app.codeStats 0ms

/V2.2/trunk/CAL/Desktop/Composite.Presentation.Tests/Mocks/MockServiceLocator.cs

#
C# | 68 lines | 42 code | 10 blank | 16 comment | 4 complexity | 0a7ea390228071e72a6812935f277510 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 Microsoft.Practices.ServiceLocation;
19
20namespace Microsoft.Practices.Composite.Presentation.Tests.Mocks
21{
22    internal class MockServiceLocator : IServiceLocator
23    {
24        public Func<Type, object> GetInstance;
25        public Func<Type, object> GetService;
26
27        object IServiceLocator.GetInstance(Type serviceType)
28        {
29            if (this.GetInstance != null)
30                return this.GetInstance(serviceType);
31
32            return null;
33        }
34
35        object IServiceProvider.GetService(Type serviceType)
36        {
37            if (this.GetService != null)
38                return this.GetService(serviceType);
39
40            return null;
41        }
42
43        System.Collections.Generic.IEnumerable<TService> IServiceLocator.GetAllInstances<TService>()
44        {
45            throw new NotImplementedException();
46        }
47
48        System.Collections.Generic.IEnumerable<object> IServiceLocator.GetAllInstances(Type serviceType)
49        {
50            throw new NotImplementedException();
51        }
52
53        TService IServiceLocator.GetInstance<TService>(string key)
54        {
55            throw new NotImplementedException();
56        }
57
58        TService IServiceLocator.GetInstance<TService>()
59        {
60            throw new NotImplementedException();
61        }
62
63        object IServiceLocator.GetInstance(Type serviceType, string key)
64        {
65            throw new NotImplementedException();
66        }
67    }
68}