public void contains_item_after_added()
        {
            const string scope_key = "key";
            const int scope_value = 0;

            var scope = new ScopeCollection<int>();
            scope.Add(scope_key, scope_value);

            Assert.IsTrue(scope.Contains(scope_key));
        }
        public void returns_correct_item_after_added()
        {
            const string scope_key   = "key";
            const int    scope_value = 0;

            var scope = new ScopeCollection <int>();

            scope.Add(scope_key, scope_value);

            Assert.AreEqual(scope_value, scope[scope_key]);
        }
        public void contains_item_after_added()
        {
            const string scope_key   = "key";
            const int    scope_value = 0;

            var scope = new ScopeCollection <int>();

            scope.Add(scope_key, scope_value);

            Assert.IsTrue(scope.Contains(scope_key));
        }
        public void contains_all_items_of_parent()
        {
            const string scope_key = "key";
            const int scope_value = 0;

            var scope = new ScopeCollection<int>();
            scope.Add(scope_key, scope_value);

            var child_scope = (ScopeCollection<int>) scope.GetChild();

            Assert.AreEqual(scope_value, child_scope[scope_key]);
        }
        public void contains_all_items_of_parent()
        {
            const string scope_key   = "key";
            const int    scope_value = 0;

            var scope = new ScopeCollection <int>();

            scope.Add(scope_key, scope_value);

            var child_scope = (ScopeCollection <int>)scope.GetChild();

            Assert.AreEqual(scope_value, child_scope[scope_key]);
        }
        public void notifies_on_new_item_added_to_same_scope()
        {
            const string scope_key = "key";
            const int scope_value = 0;

            var scope = new ScopeCollection<int>();

            bool itemAdded = false;
            scope.ItemAdded += (_, e) => { if (e.Key == scope_key) itemAdded = true; };

            scope.Add(scope_key, scope_value);

            Assert.IsTrue(itemAdded);
        }
Exemplo n.º 7
0
 private void changed(TECChangedEventArgs e)
 {
     if (e.Sender is TECTypical && e.Value is TECSystem system)
     {
         if (e.Change == Change.Add)
         {
             ScopeCollection.Add(system);
         }
         else if (e.Change == Change.Remove)
         {
             ScopeCollection.Remove(system);
         }
     }
 }
        public void notifies_on_new_item_added_to_same_scope()
        {
            const string scope_key   = "key";
            const int    scope_value = 0;

            var scope = new ScopeCollection <int>();

            bool itemAdded = false;

            scope.ItemAdded += (_, e) => { if (e.Key == scope_key)
                                           {
                                               itemAdded = true;
                                           }
            };

            scope.Add(scope_key, scope_value);

            Assert.IsTrue(itemAdded);
        }
        public void returns_correct_item_after_added()
        {
            const string scope_key = "key";
            const int scope_value = 0;

            var scope = new ScopeCollection<int>();
            scope.Add(scope_key, scope_value);

            Assert.AreEqual(scope_value, scope[scope_key]);
        }