public void EqualityTest() { var p1 = new ReAttachTarget(0, @"c:\cmd.exe", @"domain\username"); var p2 = new ReAttachTarget(0, @"c:\CmD.eXe", @"DOMAIn\USeRNAmE"); Assert.AreEqual(p1, p2); Assert.AreEqual(p1.GetHashCode(), p2.GetHashCode()); var p3 = new ReAttachTarget(1, @"c:\cmd.exe", @"domain\username"); var p4 = new ReAttachTarget(2, @"c:\CmD.eXe", @"DOMAIn\USeRNAmE"); Assert.AreEqual(p3, p4); Assert.AreEqual(p3.GetHashCode(), p4.GetHashCode()); Assert.IsTrue(p3.Equals(p4)); }
public void InequalityTest() { var p1 = new ReAttachTarget(0, @"c:\cmd.exe", @"domain\username"); var p2 = new ReAttachTarget(0, @"c:\calc.exe", @"domain\username"); Assert.AreNotEqual(p1, p2); var p3 = new ReAttachTarget(0, @"c:\cmd.exe", @"domain\username1"); var p4 = new ReAttachTarget(0, @"c:\cmd.exe", @"domain\username2"); Assert.AreNotEqual(p3, p4); Assert.AreNotEqual(null, p1); Assert.AreNotEqual(null, p2); Assert.AreNotEqual(p3, null); Assert.AreNotEqual(p4, null); Assert.IsFalse(p3.Equals(null)); }