public void EqualsTest() { CCodeUnitsCollection first = CreateObj(); CCodeUnitsCollection second = new CCodeUnitsCollection(); Assert.IsFalse(first.Equals(second)); second.Add(new CExtendedCodeUnit(new CCodeUnit(new CElementPosition(12, 23), ")"), 1, 1)); second.Add(new CExtendedCodeUnit(new CCodeUnit(new CElementPosition(13, 33), ")"), 1, 1)); second.Add(new CExtendedCodeUnit(new CCodeUnit(new CElementPosition(14, 43), ")"), 1, 1)); Assert.IsTrue(first.Equals(second)); second.Add(new CExtendedCodeUnit(new CCodeUnit(new CElementPosition(12, 23), ")"), 1, 1)); Assert.IsFalse(first.Equals(second)); }
/// <summary> /// Определяет, равны ли 2 фрагмента кода /// </summary> /// <param name="other"></param> /// <returns></returns> public bool Equals(CCodeFragment other) { if (other == null) { return(false); } if (Object.ReferenceEquals(this, other)) { return(true); } return(m_Content.Equals(other.m_Content)); }