public void CanGetIndexOfKey()
        {
            DictionaryOrdered <string, string> dict = CreateDefault();
            int ndx = dict.IndexOfKey("3");

            Assert.AreEqual(2, ndx);
        }
 /// <summary>
 /// Initialize with loggers.
 /// </summary>
 /// <param name="loggers"></param>
 public void Init(string name, IList <ILog> loggers)
 {
     this.Name = name;
     _loggers  = new DictionaryOrdered <string, ILog>();
     loggers.ForEach(logger => _loggers.Add(logger.Name, logger));
     ActivateOptions();
 }
        public void CanInsert()
        {
            DictionaryOrdered <string, string> dict = CreateDefault();

            dict.Insert(2, "2a", "b2");
            string val = dict["2a"];
            int    ndx = dict.IndexOfKey("2a");

            Assert.AreEqual("b2", val);
            Assert.AreEqual(2, ndx);
        }
        public DictionaryOrdered <string, string> CreateDefault()
        {
            DictionaryOrdered <string, string> dict = new DictionaryOrdered <string, string>();

            dict.Add("1", "a");
            dict.Add("2", "b");
            dict.Add("3", "c");
            dict.Add("4", "d");

            return(dict);
        }
        public void CanRemove()
        {
            DictionaryOrdered <string, string> dict = CreateDefault();

            dict.Remove("3");
            bool   containsKey = dict.ContainsKey("3");
            int    ndx         = dict.IndexOfKey("3");
            string valAtIndex  = dict[2];

            Assert.IsFalse(containsKey);
            Assert.AreEqual(-1, ndx);
            Assert.AreEqual("d", valAtIndex);
        }
 /// <summary>
 /// Initialize the default logger.
 /// </summary>
 /// <param name="logger"></param>
 public static void Init(ILogMulti logger)
 {
     ExecuteWrite(() =>
     {
         if (_loggers == null)
         {
             _loggers = new DictionaryOrdered <string, ILogMulti>();
         }
         _loggers["default"] = new LogMulti("default", new List <ILog>()
         {
             logger
         });
     });
 }
Exemple #7
0
 public Override(Override src)
 {
     dict = new DictionaryOrdered <string, ObjType>(src.dict);
 }