PageRenderTime 42ms CodeModel.GetById 19ms RepoModel.GetById 0ms app.codeStats 0ms

/V2/trunk/RI/Desktop/StockTraderRI.Modules.WatchList.Tests/Mocks/MockRegionManager.cs

#
C# | 163 lines | 116 code | 31 blank | 16 comment | 0 complexity | c20bbedb72f07ec9a894c62b8c4db8cf 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;
  19. using System.Collections.Generic;
  20. using System.ComponentModel;
  21. using Microsoft.Practices.Composite.Regions;
  22. namespace StockTraderRI.Modules.WatchList.Tests.Mocks
  23. {
  24. public class MockRegionManager : IRegionManager
  25. {
  26. private readonly MockRegionCollection _regions = new MockRegionCollection();
  27. public IRegionCollection Regions
  28. {
  29. get { return _regions; }
  30. }
  31. #region Not implemented
  32. public IRegion AttachNewRegion(object regionTarget, string regionName)
  33. {
  34. throw new NotImplementedException();
  35. }
  36. public IRegionManager CreateRegionManager()
  37. {
  38. throw new NotImplementedException();
  39. }
  40. #endregion
  41. }
  42. internal class MockRegionCollection : IRegionCollection
  43. {
  44. private Dictionary<string, IRegion> regions = new Dictionary<string, IRegion>();
  45. public IEnumerator<IRegion> GetEnumerator()
  46. {
  47. throw new System.NotImplementedException();
  48. }
  49. IEnumerator IEnumerable.GetEnumerator()
  50. {
  51. return GetEnumerator();
  52. }
  53. public IRegion this[string regionName]
  54. {
  55. get { return regions[regionName]; }
  56. }
  57. public void Add(IRegion region)
  58. {
  59. regions[region.Name] = region;
  60. }
  61. public bool Remove(string regionName)
  62. {
  63. throw new System.NotImplementedException();
  64. }
  65. public bool ContainsRegionWithName(string regionName)
  66. {
  67. throw new System.NotImplementedException();
  68. }
  69. }
  70. public class MockRegion : IRegion
  71. {
  72. public List<object> AddedViews = new List<object>();
  73. public bool ActivateCalled;
  74. public object ActivateArg;
  75. #region IRegion Members
  76. public string Name { get; set; }
  77. public IRegionManager Add(object view)
  78. {
  79. AddedViews.Add(view);
  80. return null;
  81. }
  82. public void Remove(object view)
  83. {
  84. throw new NotImplementedException();
  85. }
  86. public IViewsCollection Views
  87. {
  88. get { throw new NotImplementedException(); }
  89. }
  90. public IViewsCollection ActiveViews
  91. {
  92. get { throw new NotImplementedException(); }
  93. }
  94. public object Context
  95. {
  96. get { throw new System.NotImplementedException(); }
  97. set { throw new System.NotImplementedException(); }
  98. }
  99. public void Activate(object view)
  100. {
  101. ActivateCalled = true;
  102. ActivateArg = view;
  103. }
  104. public void Deactivate(object view)
  105. {
  106. throw new NotImplementedException();
  107. }
  108. public IRegionManager Add(object view, string viewName)
  109. {
  110. throw new NotImplementedException();
  111. }
  112. public object GetView(string viewName)
  113. {
  114. throw new NotImplementedException();
  115. }
  116. public IRegionManager Add(object view, string viewName, bool createRegionManagerScope)
  117. {
  118. throw new NotImplementedException();
  119. }
  120. public IRegionManager RegionManager
  121. {
  122. get { throw new NotImplementedException(); }
  123. set { throw new NotImplementedException(); }
  124. }
  125. public IRegionBehaviorCollection Behaviors
  126. {
  127. get { throw new System.NotImplementedException(); }
  128. }
  129. #endregion
  130. public event PropertyChangedEventHandler PropertyChanged;
  131. }
  132. }