using CoviDok.BLL.Sessions;
using System;
using System.Collections.Generic;
using System.Text;

namespace CoviDok.Data.SessionProviders
{
    // Class is not thread safe, should only be used for testing
    class DummySessionProvider : ISessionProvider
    {
        private readonly Dictionary<string, string> dict;
        public DummySessionProvider()
        {
            dict = new Dictionary<string, string>();
        }

        public void Del(string key)
        {
            dict.Remove(key);
        }

        public string Get(string key)
        {
            try
            {
                return dict[key];
            }
            catch (KeyNotFoundException)
            {
                return null;
            }
            
        }

        public void Set(string key, string value)
        {
            dict[key] = value;
        }
    }
}