PageRenderTime 19ms CodeModel.GetById 12ms app.highlight 3ms RepoModel.GetById 2ms app.codeStats 0ms

/V1/spikes/AGCompositeApplicationLibrary/AGComposite.Wpf.Tests/Mocks/MockViewsCollection.cs

#
C# | 52 lines | 29 code | 7 blank | 16 comment | 0 complexity | 436d7f60e343f77d8ae55a3bcf15b0c9 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
18
19using System.Collections;
20using System.Collections.Generic;
21using System.Collections.ObjectModel;
22using System.Collections.Specialized;
23using Microsoft.Practices.Composite.Regions;
24
25namespace Microsoft.Practices.Composite.Wpf.Tests.Mocks
26{
27    class MockViewsCollection : IViewsCollection
28    {
29        public ObservableCollection<object> Items = new ObservableCollection<object>();
30
31        public bool Contains(object value)
32        {
33            return Items.Contains(value);
34        }
35
36        public IEnumerator<object> GetEnumerator()
37        {
38            return Items.GetEnumerator();
39        }
40
41        IEnumerator IEnumerable.GetEnumerator()
42        {
43            return GetEnumerator();
44        }
45
46        public event NotifyCollectionChangedEventHandler CollectionChanged
47        {
48            add { Items.CollectionChanged += value; }
49            remove { Items.CollectionChanged -= value; }
50        }
51    }
52}