Filter:   InfoImg
download RegistrationKeyMock.cs
Language: C#
License: MSVSSDK
LOC: 41
Project Info
C# Common.UnitTest
Server: Visual Studio SDK
Type: filesystem
...mon\Source\CSharp\UnitTest\
   BaseMock.cs
   ConnectionPointHelper.cs
   FileGenerator.cs
   GenericMockFactory.cs
   LocalRegistryMock.cs
   ....UnitTestLibrary.csproj
   ...SDK.UnitTestLibrary.sln
   MockBuildEngine.cs
   OleServiceProvider.cs
   OutputWindowPane.cs
   OutputWindowService.cs
   RegistrationContextMock.cs
   RegistrationKeyMock.cs
   TextWriterMock.cs

/***************************************************************************

Copyright (c) Microsoft Corporation. All rights reserved.
This code is licensed under the Visual Studio SDK license terms.
THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF
ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY
IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR
PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.

***************************************************************************/

using System;
using System.Text;
using System.Collections.Generic;
using Microsoft.VisualStudio.Shell.Interop;
using Microsoft.VsSDK.UnitTestLibrary;
using Microsoft.VisualStudio.Shell;
using System.Collections;

namespace Microsoft.VsSDK.UnitTestLibrary
{
    
    public class RegistrationKeyMock : RegistrationAttribute.Key
    {
        private Hashtable _table = new Hashtable();

        /// <summary>
        /// Constructor
        /// </summary>
        public RegistrationKeyMock()
        {

        }

        /// <summary>
        /// Collection of keys that are added.
        /// </summary>
        public Hashtable Keys
        {
            get
            {
                return _table;
            }
        }

        /// <summary>
        /// Close the key
        /// </summary>
        public override void Close()
        {
            return;
        }

        /// <summary>
        /// Create a sub key under the key with name
        /// </summary>
        /// <param name="name">name of the sub key</param>
        /// <returns>Key instance</returns>
        public override RegistrationAttribute.Key CreateSubkey(string name)
        {
            throw new NotImplementedException("The method or operation is not implemented.");
        }

        /// <summary>
        /// Set the reg key value
        /// </summary>
        /// <param name="valueName">name of the value</param>
        /// <param name="value">value</param>
        public override void SetValue(string valueName, object value)
        {
            string val = value.ToString().ToUpperInvariant();
            string name = valueName.ToUpperInvariant();
            if (!_table.Contains(name))
                _table.Add(name, val);
            else
                _table[name] = val;
        }
    }
}