public void TestOperators() { ParsedPath pp = new ParsedPath("file.txt", PathType.Unknown); Assert.IsFalse(pp == null); Assert.IsFalse(null == pp); Assert.IsTrue(pp != null); Assert.IsTrue(null != pp); Assert.IsFalse(pp.Equals(null)); Assert.IsFalse(ParsedPath.Equals(pp, null)); Assert.IsFalse(ParsedPath.Equals(null, pp)); Assert.AreNotEqual(0, pp.GetHashCode()); Assert.IsFalse(pp == ParsedPath.Empty); }
/// <summary> /// Returns <code>true</code> if two <see cref="ParsedPath"/> objects are equal. /// </summary> /// <param name="pp1"></param> /// <param name="pp2"></param> /// <returns></returns> public static bool Equals(ParsedPath pp1, ParsedPath pp2) { if ((object)pp1 == (object)pp2) return true; if ((object)pp1 == null || (object)pp2 == null) return false; return pp1.Equals(pp2); }