public virtual void testGet()
        {
            JDFAttributeMap m1 = new JDFAttributeMap(EnumPartIDKey.SignatureName, "v1");

            Assert.AreEqual("v1", m1.get("SignatureName"));
            m1.put(EnumPartIDKey.SheetName, "s1");
            Assert.AreEqual("v1", m1.get(EnumPartIDKey.SignatureName));
        }
        public virtual void testPut()
        {
            JDFAttributeMap m1 = new JDFAttributeMap(EnumPartIDKey.SignatureName, "v1");

            Assert.AreEqual("v1", m1.get("SignatureName"));
            m1.put(EnumPartIDKey.SheetName, "s1");
            Assert.AreEqual("s1", m1.get("SheetName"));
            m1.put(EnumPartIDKey.Side, EnumSide.Front);
            Assert.AreEqual("Front", m1.get("Side"));
            m1.put("Usage", EnumUsage.Input);
            Assert.AreEqual("Input", m1.get("Usage"));
        }
Exemple #3
0
        public virtual bool hasEntryWithEqualKeyValuePairs(JDFAttributeMap attmap)
        {
            bool bEquals = false;

            for (int i = 0; i < Count; i++)
            {
                // if its the same object...ne further action needed
                if (attmap == this[i])
                {
                    return(true);
                }

                // reset for every entry
                bEquals = false;
                JDFAttributeMap map = this[i];

                // only check if both have the same size

                if (map.Count == attmap.Count)
                {
                    // now that we found a entry with same entry counter set
                    // this to true. A single wrong entry will set it to false and
                    // break. If bEquals is still true after all checks, we found
                    // the map
                    bEquals = true;
                    IEnumerator <string> it = map.getKeyIterator();
                    while (it.MoveNext())
                    {
                        string key = it.Current;
                        if (!attmap.ContainsKey(key))
                        {
                            bEquals = false;
                            break;
                        }
                        string value1 = map.get(key);
                        string value2 = attmap.get(key);
                        if (!value1.Equals(value2))
                        {
                            bEquals = false;
                            break;
                        }
                    }
                    // if bEquals is still true we found a matching map
                    if (bEquals)
                    {
                        return(bEquals);
                    }
                }
            }

            return(bEquals);
        }
        public virtual void testCloneNull()
        {
            JDFAttributeMap m1 = new JDFAttributeMap(null);

            m1.put("a2", "v2");
            JDFAttributeMap m2 = new JDFAttributeMap(m1);

            Assert.AreEqual(m1, m2);
            m2.put("a2", "v3");
            Assert.AreNotEqual(m1, m2);
            Assert.AreEqual("v2", m1.get("a2"));
            Assert.AreEqual("v3", m2.get("a2"));
        }