Esempio n. 1
0
        /// <summary>
        /// Returns value for the given key.
        /// If the key does not exists, returns the value indicated by defaultValue parameter
        /// </summary>
        /// <param name="key"></param>
        /// <param name="defaultValue"></param>
        /// <returns></returns>
        public override string GetValue(string key, string defaultValue = null)
        {
            base.GetValue(key, defaultValue);

            if (MockStorage.ContainsKey(key))
            {
                return(MockStorage[key]);
            }

            return(defaultValue);
        }
Esempio n. 2
0
        /// <summary>
        /// Deletes key from the collection, if it exists
        /// Returns true, if the key exists. False, if it does not exist
        /// </summary>
        /// <param name="key"></param>
        /// <returns></returns>
        public override bool DeleteKey(string key)
        {
            base.DeleteKey(key);

            if (MockStorage.ContainsKey(key))
            {
                MockStorage.Remove(key);

                return(true);
            }

            return(false);
        }
Esempio n. 3
0
        /// <summary>
        /// Checks if the key has any value set
        /// </summary>
        /// <param name="key"></param>
        /// <returns></returns>
        public override bool HasKey(string key)
        {
            base.HasKey(key);

            return(MockStorage.ContainsKey(key));
        }