public void TestSameTypeEquality()
 {
     Load l = new Load("ID", Complex.Zero);
     var conn1 = new NetworkElementConnection(l, 1);
     var conn2 = new NetworkElementConnection(l, 1);
     Assert.IsTrue(conn1.Equals(conn2) && conn2.Equals(conn1));
 }
 public void TestEqualityWithNull()
 {
     Load l = new Load("ID", Complex.Zero);
     var conn1 = new NetworkElementConnection(l, 1);
     Assert.IsFalse(conn1.Equals(null));
     Assert.IsFalse(NetworkElementConnection.Equals(conn1, null));
 }
 public void TestOperatorOverloadEquality()
 {
     Load l = new Load("ID", Complex.Zero);
     var conn1 = new NetworkElementConnection(l, 1);
     var conn2 = new NetworkElementConnection(l, 1);
     Assert.IsTrue(conn1 == conn2);
     Assert.IsFalse(conn1 != conn2);
 }
 public void TestSameTypeInequality()
 {
     Load l = new Load("ID", Complex.Zero);
     var conn1 = new NetworkElementConnection(l, 1);
     var conn2 = new NetworkElementConnection(l, 2);
     var conn3 = new NetworkElementConnection(new Load("ID",0), 1);
     Assert.IsFalse(conn1.Equals(conn2));
     Assert.IsFalse(conn2.Equals(conn1));
     Assert.IsFalse(conn1.Equals(conn3));
 }
Ejemplo n.º 5
0
 /// <summary>
 /// Compares between this and another <see cref="NetworkElementConnection"/> for member-wise equality.
 /// </summary>
 /// <param name="obj">The other <see cref="NetworkElementConnection"/> to compare to.</param>
 /// <returns><c>true</c> if the two elements are equal.</returns>
 public bool Equals(NetworkElementConnection obj)
 {
     return(obj.Element == this.Element &&
            obj.Phase == this.Phase);
 }
 /// <summary>
 /// Compares between this and another <see cref="NetworkElementConnection"/> for member-wise equality.
 /// </summary>
 /// <param name="obj">The other <see cref="NetworkElementConnection"/> to compare to.</param>
 /// <returns><c>true</c> if the two elements are equal.</returns>
 public bool Equals(NetworkElementConnection obj)
 {
     return  obj.Element == this.Element &&
             obj.Phase   == this.Phase;
 }