Esempio n. 1
0
        public void ObjectToString()
        {
            var edge1 = new SReversedEdge <int, Edge <int> >(new Edge <int>(1, 2));
            var edge2 = new SReversedEdge <int, Edge <int> >(new Edge <int>(2, 1));
            var edge3 = new SReversedEdge <int, UndirectedEdge <int> >(new UndirectedEdge <int>(1, 2));

            Assert.AreEqual("R(1 -> 2)", edge1.ToString());
            Assert.AreEqual("R(2 -> 1)", edge2.ToString());
            Assert.AreEqual("R(1 <-> 2)", edge3.ToString());
        }
Esempio n. 2
0
        public void SReversedEdgeTestEverything()
        {
            var originalEdge1 = new SEquatableEdge <int>(0, 1);
            var reversedEdge1 = new SReversedEdge <int, SEquatableEdge <int> >(originalEdge1);

            Assert.AreEqual(1, reversedEdge1.Source);
            Assert.AreEqual(0, reversedEdge1.Target);
            Assert.AreEqual(String.Format("R({0}->{1})", 0, 1), reversedEdge1.ToString());

            //equatable parts
            var originalEdge2 = new SEquatableEdge <int>(2, 3);
            var reversedEdge2 = new SReversedEdge <int, SEquatableEdge <int> >(originalEdge2);

            Assert.IsFalse(reversedEdge1.Equals(reversedEdge2));
            Assert.IsFalse(reversedEdge1.Equals(1));
            Assert.IsFalse(reversedEdge1 == reversedEdge2);
            Assert.IsTrue(reversedEdge1 != reversedEdge2);
            Assert.IsFalse(reversedEdge1.GetHashCode() == reversedEdge2.GetHashCode());
        }