public void AddExistingGroupTest()
        {
            GroupedProperties groupProperties = new GroupedProperties();

            groupProperties.Add(Default);
            groupProperties.Add(Default);

            // no effect on PropertyGroups
            Assert.AreEqual(1, groupProperties.PropertyGroups.Count);
            Assert.IsTrue(groupProperties.PropertyGroups.ContainsKey(Default));
        }
        public void EqualsObjectTest()
        {
            GroupedProperties groupProperties = new GroupedProperties();

            groupProperties.Add(Default);
            groupProperties.Add(Default, Name, NameValue);
            groupProperties.Add(Default, Email, EmailValue);

            bool bRet = groupProperties.Equals((object)groupProperties);

            Assert.IsTrue(bRet);
        }
        public void AddPropertyDuplicateTest()
        {
            GroupedProperties groupProperties = new GroupedProperties();

            groupProperties.Add(Default);
            groupProperties.Add(Default, Name, NameValue);
            groupProperties.Add(Default, Email, EmailValue);
            groupProperties.Add(Default, Name, NameValue);

            Assert.AreEqual(1, groupProperties.PropertyGroups.Count);
            Assert.IsTrue(groupProperties.PropertyGroups.ContainsKey(Default));
            Assert.AreEqual(2, groupProperties.PropertyGroups[Default].Count);
            Assert.AreEqual(NameValue, groupProperties[Default, Name]);
            Assert.AreEqual(EmailValue, groupProperties[Default, Email]);
        }
        public void EqualsFalse2Test()
        {
            GroupedProperties groupProperties = new GroupedProperties();

            groupProperties.Add(Default);
            groupProperties.Add(Default, Name, NameValue);
            groupProperties.Add(Default, Email, EmailValue);

            GroupedProperties othergroupProperties = new GroupedProperties();

            othergroupProperties.Add(Default);
            othergroupProperties.Add(Default, Name, NameValue);
            othergroupProperties.Add(Default, Email, NotEmailValue);

            bool bRet = groupProperties.Equals(othergroupProperties);

            Assert.IsFalse(bRet);
        }
        public void SetTest()
        {
            GroupedProperties groupProperties = new GroupedProperties(Default);

            groupProperties.Add(Default, Name, NameValue);

            groupProperties.Set(Default, Name, NotNameValue);

            Assert.AreEqual(NotNameValue, groupProperties.Get(Default, Name));
        }
        public void AddPropertyAnotherGroupTest()
        {
            GroupedProperties groupProperties = new GroupedProperties(Default);

            groupProperties.Add(NotDefault, Name, NameValue);

            Assert.AreEqual(0, groupProperties[Default].Count);
            Assert.IsFalse(groupProperties.PropertyGroups.ContainsKey(NotDefault));
            Assert.IsFalse(groupProperties[Default].ContainsKey(Name));
        }
        public void AddPropertyTest()
        {
            GroupedProperties groupProperties = new GroupedProperties(Default);

            groupProperties.Add(Default, Name, NameValue);

            Assert.AreEqual(1, groupProperties[Default].Count);
            Assert.IsTrue(groupProperties[Default].ContainsKey(Name));
            Assert.AreEqual(NameValue, groupProperties[Default, Name]);
        }
        public void SetGroupNotExistTest()
        {
            GroupedProperties groupProperties = new GroupedProperties(Default);

            groupProperties.Add(Default, Name, NameValue);

            groupProperties.Set(NotDefault, Name, NameValue);

            Assert.AreEqual(NameValue, groupProperties.Get(Default, Name));
            Assert.IsTrue(string.IsNullOrEmpty(groupProperties.Get(NotDefault, Name)));
        }
示例#9
0
        public void Add(DashboardNodePropertyBase property)
        {
            CheckType(property);

            if (GroupedProperties.Contains(property))
            {
                return;
            }

            GroupedProperties.Add(property);
            property.Group = this;
            property.GenericProxy.Value = GroupedProperties.First().GenericProxy.Value;
        }
        public void RemoveGroupTest()
        {
            GroupedProperties groupProperties = new GroupedProperties(Default);

            groupProperties.Add(NotDefault);

            Assert.AreEqual(2, groupProperties.PropertyGroups.Count);
            Assert.IsTrue(groupProperties.PropertyGroups.ContainsKey(Default));
            Assert.IsTrue(groupProperties.PropertyGroups.ContainsKey(NotDefault));

            groupProperties.Remove(NotDefault);

            Assert.AreEqual(1, groupProperties.PropertyGroups.Count);
            Assert.IsTrue(groupProperties.PropertyGroups.ContainsKey(Default));
            Assert.IsFalse(groupProperties.PropertyGroups.ContainsKey(NotDefault));
        }