/*************************************************************************** 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.Collections; using System.Diagnostics.CodeAnalysis; using Microsoft.VisualStudio.Shell; namespace Microsoft.VsSDK.UnitTestLibrary { [CLSCompliant(false)] public class RegistrationKeyMock : RegistrationAttribute.Key { private Hashtable _table = new Hashtable(); /// /// Constructor /// public RegistrationKeyMock() { } /// /// Collection of keys that are added. /// public Hashtable Keys { get { return this._table; } } /// /// Close the key /// public override void Close() { return; } /// /// Create a sub key under the key with name /// /// name of the sub key /// Key instance [SuppressMessage("Microsoft.Globalization", "CA1303:DoNotPassLiteralsAsLocalizedParameters")] public override RegistrationAttribute.Key CreateSubkey(string name) { throw new NotImplementedException("The method or operation is not implemented."); } /// /// Set the reg key value /// /// name of the value /// value [SuppressMessage("Microsoft.Performance", "CA1807:AvoidUnnecessaryStringCreation")] [SuppressMessage("Microsoft.Design", "CA1062:ValidateArgumentsOfPublicMethods")] public override void SetValue(string valueName, object value) { var val = value.ToString().ToUpperInvariant(); var name = valueName.ToUpperInvariant(); if (!this._table.Contains(name)) this._table.Add(name, val); else this._table[name] = val; } internal void RemoveValue(string valueName) { var name = valueName.ToUpperInvariant(); if (this._table.Contains(name)) this._table.Remove(name); } internal bool IsEmpty() { return this._table.Count == 0; } } }