public virtual void TestEquals() { FontCharacteristics fontCharacteristics = new FontCharacteristics(); fontCharacteristics.SetFontStyle("italic"); fontCharacteristics.SetFontWeight((short)300); FontCharacteristics sameFontCharacteristics = new FontCharacteristics(); sameFontCharacteristics.SetFontStyle("italic"); sameFontCharacteristics.SetFontWeight((short)300); NUnit.Framework.Assert.IsTrue(fontCharacteristics.Equals(sameFontCharacteristics)); FontCharacteristics copyFontCharacteristics = new FontCharacteristics(fontCharacteristics); NUnit.Framework.Assert.IsTrue(fontCharacteristics.Equals(copyFontCharacteristics)); FontCharacteristics diffFontCharacteristics = new FontCharacteristics(); fontCharacteristics.SetBoldFlag(true); fontCharacteristics.SetFontWeight((short)800); NUnit.Framework.Assert.IsFalse(fontCharacteristics.Equals(diffFontCharacteristics)); }
public override bool Equals(Object o) { if (this == o) { return(true); } if (o == null || GetType() != o.GetType()) { return(false); } iText.Layout.Font.FontSelectorKey that = (iText.Layout.Font.FontSelectorKey)o; return(Enumerable.SequenceEqual(fontFamilies, that.fontFamilies) && (fc != null ? fc.Equals(that.fc) : that .fc == null)); }