Example #1
0
        public void SetNonDependentKey()
        {
            var dictionary = new DependentDictionary <int, string>(keys, i => i.ToString(), allowOther: true);

            dictionary[6] = "test";
            Assert.That(dictionary[6], Is.EqualTo("test"));
        }
Example #2
0
        public void CountIncludesNonDependentValues()
        {
            var dictionary = new DependentDictionary <int, string>(keys, i => i.ToString(), allowOther: true);

            dictionary[6] = "test";
            Assert.That(dictionary.Count, Is.EqualTo(6));
        }
Example #3
0
 public void Setup()
 {
     keys = new List <int> {
         1, 2, 3, 4, 5
     };
     dictionary = new DependentDictionary <int, string>(keys, i => i.ToString());
 }
Example #4
0
        public void DoesntRegenerateValues()
        {
            var dictionary = new DependentDictionary <int, object>(Enumerable.Range(1, 1), x => new object());
            var value1     = dictionary[1];
            var value2     = dictionary[1];

            Assert.That(value1, Is.EqualTo(value2));
        }