PageRenderTime 49ms CodeModel.GetById 19ms RepoModel.GetById 0ms 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. //===================================================================================
  17. using System;
  18. using Microsoft.Practices.ServiceLocation;
  19. namespace Microsoft.Practices.Composite.Presentation.Tests.Mocks
  20. {
  21. internal class MockServiceLocator : IServiceLocator
  22. {
  23. public Func<Type, object> GetInstance;
  24. public Func<Type, object> GetService;
  25. object IServiceLocator.GetInstance(Type serviceType)
  26. {
  27. if (this.GetInstance != null)
  28. return this.GetInstance(serviceType);
  29. return null;
  30. }
  31. object IServiceProvider.GetService(Type serviceType)
  32. {
  33. if (this.GetService != null)
  34. return this.GetService(serviceType);
  35. return null;
  36. }
  37. System.Collections.Generic.IEnumerable<TService> IServiceLocator.GetAllInstances<TService>()
  38. {
  39. throw new NotImplementedException();
  40. }
  41. System.Collections.Generic.IEnumerable<object> IServiceLocator.GetAllInstances(Type serviceType)
  42. {
  43. throw new NotImplementedException();
  44. }
  45. TService IServiceLocator.GetInstance<TService>(string key)
  46. {
  47. throw new NotImplementedException();
  48. }
  49. TService IServiceLocator.GetInstance<TService>()
  50. {
  51. throw new NotImplementedException();
  52. }
  53. object IServiceLocator.GetInstance(Type serviceType, string key)
  54. {
  55. throw new NotImplementedException();
  56. }
  57. }
  58. }