public void TearDown()
 {
     m_oGraphVertexEdgeBase = null;
 }
 //*************************************************************************
 //  Constructor: GraphVertexEdgeBaseTest()
 //
 /// <summary>
 /// Initializes a new instance of the <see
 /// cref="GraphVertexEdgeBaseTest" /> class.
 /// </summary>
 //*************************************************************************
 public GraphVertexEdgeBaseTest()
 {
     m_oGraphVertexEdgeBase = null;
 }
 public void SetUp()
 {
     m_oGraphVertexEdgeBase = new MockGraphVertexEdgeBase();
 }
        public void TestCopyTo4()
        {
            // Set the Tag on m_oGraphVertexEdgeBase and copy it.

            const String Tag = "This is the tag.";

            m_oGraphVertexEdgeBase.Tag = Tag;

            GraphVertexEdgeBase oCopy = new MockGraphVertexEdgeBase();

            Int32 iID = oCopy.ID;

            m_oGraphVertexEdgeBase.CopyTo(oCopy, false, true);

            Assert.AreEqual(iID, oCopy.ID);
            Assert.IsNull(oCopy.Name);
            Assert.AreEqual(Tag, oCopy.Tag);
        }
        public void TestCopyTo9()
        {
            // Create N objects, set random metadata on each object, copy each
            // object's metadata to a new object, check metadata on new object.

            const Int32 Objects = 1976;

            MockGraphVertexEdgeBase [] aoGraphVertexEdgeBase =
            new MockGraphVertexEdgeBase[Objects];

            // Set random values on each object.

            for (Int32 i = 0; i < Objects; i++)
            {
            GraphVertexEdgeBase oGraphVertexEdgeBase =
                aoGraphVertexEdgeBase[i] = new MockGraphVertexEdgeBase();

            MetadataUtil.SetRandomMetadata(
                oGraphVertexEdgeBase, true, true, i);
            }

            for (Int32 i = 0; i < Objects; i++)
            {
            // Copy the object's metadata to a new object.

            MockGraphVertexEdgeBase oGraphVertexEdgeBase =
                aoGraphVertexEdgeBase[i];

            MockGraphVertexEdgeBase oCopy = new MockGraphVertexEdgeBase();

            oGraphVertexEdgeBase.CopyTo(oCopy, true, true);

            // Check the metadata on the new object.

            MetadataUtil.CheckRandomMetadata(oCopy, true, true, i);
            }
        }
        public void TestCopyTo2()
        {
            // Set the name on m_oGraphVertexEdgeBase.

            const String Name = "jkfdklerw";

            m_oGraphVertexEdgeBase.Name = Name;

            GraphVertexEdgeBase oCopy = new MockGraphVertexEdgeBase();

            Int32 iID = oCopy.ID;

            m_oGraphVertexEdgeBase.CopyTo(oCopy, false, false);

            Assert.AreEqual(iID, oCopy.ID);
            Assert.AreEqual(Name, oCopy.Name);
            Assert.IsNull(oCopy.Tag);
        }
        public void TestCopyTo()
        {
            // Don't set any properties on m_oGraphVertexEdgeBase.

            GraphVertexEdgeBase oCopy = new MockGraphVertexEdgeBase();

            Int32 iID = oCopy.ID;

            m_oGraphVertexEdgeBase.CopyTo(oCopy, false, false);

            Assert.AreEqual(iID, oCopy.ID);
            Assert.IsNull(oCopy.Name);
            Assert.IsNull(oCopy.Tag);
        }
        //*************************************************************************
        //  Method: TestCopyTo()
        //
        /// <summary>
        /// Tests the CopyTo() method.
        /// </summary>
        ///
        /// <param name="bCopyMetadataValues">
        /// true to copy the metadata values.
        /// </param>
        ///
        /// <param name="bCopyTag">
        /// true to copy the Tag.
        /// </param>
        //*************************************************************************
        protected void TestCopyTo(
            Boolean bCopyMetadataValues,
            Boolean bCopyTag
            )
        {
            // Set some key/value pairs and the Tag on m_oGraphVertexEdgeBase.

            const Int32 Tag = -29;

            const String Key1 = "xyz";
            const Int32 Value1 = 123456;

            const String Key2 = "xx8372";
            DateTime Value2 = DateTime.Now;

            m_oGraphVertexEdgeBase.SetValue(Key1, Value1);
            m_oGraphVertexEdgeBase.SetValue(Key2, Value2);

            m_oGraphVertexEdgeBase.Tag = Tag;

            GraphVertexEdgeBase oCopy = new MockGraphVertexEdgeBase();

            Int32 iID = oCopy.ID;

            m_oGraphVertexEdgeBase.CopyTo(oCopy, bCopyMetadataValues, bCopyTag);

            Assert.AreEqual(iID, oCopy.ID);
            Assert.IsNull(oCopy.Name);

            if (bCopyMetadataValues)
            {
            Assert.IsTrue( oCopy.ContainsKey(Key1) );
            Assert.AreEqual(Value1, oCopy.GetValue( Key1, typeof(Int32) ) );

            Assert.IsTrue( oCopy.ContainsKey(Key2) );
            Assert.AreEqual(Value2, oCopy.GetValue( Key2, typeof(DateTime) ) );
            }
            else
            {
            Assert.IsFalse( oCopy.ContainsKey(Key1) );
            Assert.IsFalse( oCopy.ContainsKey(Key2) );
            }

            if (bCopyTag)
            {
            Assert.AreEqual(Tag, oCopy.Tag);
            }
            else
            {
            Assert.IsNull(oCopy.Tag);
            }
        }
        public void TestSetGetValue6()
        {
            // Add random keys and tags for each of N GraphVertexEdgeBase objects.

            // Create an array of GraphVertexEdgeBase objects and set random keys
            // and tags on them.

            const Int32 GraphVertexEdgeBaseObjects = 10000;

            GraphVertexEdgeBase [] aoGraphVertexEdgeBase =
            new GraphVertexEdgeBase[GraphVertexEdgeBaseObjects];

            for (Int32 i = 0; i < GraphVertexEdgeBaseObjects; i++)
            {
            GraphVertexEdgeBase oGraphVertexEdgeBase =
                aoGraphVertexEdgeBase[i] = new MockGraphVertexEdgeBase();

            MetadataUtil.SetRandomMetadata(
                oGraphVertexEdgeBase, true, true, i);
            }

            // Check the values, backwards.

            for (Int32 i = GraphVertexEdgeBaseObjects - 1; i >= 0; i--)
            {
            MetadataUtil.CheckRandomMetadata(
                aoGraphVertexEdgeBase[i], true, true, i);
            }
        }
        public void TestSetGetValue5()
        {
            // Add N keys for each of N GraphVertexEdgeBase objects, ask for same
            // keys in reverse order.

            // Create an array of keys.

            const Int32 Keys = 10;

            String [] asKeys = new String[Keys];

            for (Int32 i = 0; i < Keys; i++)
            {
            asKeys[i] = Guid.NewGuid().ToString();
            }

            // Create an array of GraphVertexEdgeBase objects.

            const Int32 GraphVertexEdgeBaseObjects = 10000;

            GraphVertexEdgeBase [] aoGraphVertexEdgeBase =
            new GraphVertexEdgeBase[GraphVertexEdgeBaseObjects];

            for (Int32 j = 0; j < GraphVertexEdgeBaseObjects; j++)
            {
            aoGraphVertexEdgeBase[j] = new MockGraphVertexEdgeBase();
            }

            // Add a value for each key.  The value is just the key with appended
            // indexes.

            for (Int32 j = 0; j < GraphVertexEdgeBaseObjects; j++)
            {
            GraphVertexEdgeBase oGraphVertexEdgeBase =
                aoGraphVertexEdgeBase[j];

            for (Int32 i = 0; i < Keys; i++)
            {
                String sKey = asKeys[i];

                oGraphVertexEdgeBase.SetValue(
                    sKey, sKey + i.ToString() + j.ToString() );
            }
            }

            // Retrieve the values.

            Boolean bContainsKey;

            for (Int32 j = GraphVertexEdgeBaseObjects - 1; j >= 0; j--)
            {
            GraphVertexEdgeBase oGraphVertexEdgeBase =
                aoGraphVertexEdgeBase[j];

            for (Int32 i = Keys - 1; i >= 0; i--)
            {
                String sKey = asKeys[i];

                bContainsKey = oGraphVertexEdgeBase.ContainsKey(sKey);

                Assert.IsTrue(bContainsKey);

                MetadataUtil.TestGetValue( oGraphVertexEdgeBase, sKey,
                    sKey + i.ToString() + j.ToString() );
            }

            // Ask for a non-existent value.

            bContainsKey = oGraphVertexEdgeBase.ContainsKey("nHnHn");

            Assert.IsFalse(bContainsKey);
            }

            // Create another GraphVertexEdgeBase object and verify that it
            // contains no keys.

            GraphVertexEdgeBase oGraphVertexEdgeBaseNoKeys =
            new MockGraphVertexEdgeBase();

            for (Int32 i = 0; i < Keys; i++)
            {
            String sKey = asKeys[i];

            bContainsKey = oGraphVertexEdgeBaseNoKeys.ContainsKey(sKey);

            Assert.IsFalse(bContainsKey);
            }
        }