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