public virtual void TestBoldFlag() { FontCharacteristics fontCharacteristics = new FontCharacteristics(); NUnit.Framework.Assert.IsFalse(fontCharacteristics.IsBold()); NUnit.Framework.Assert.IsTrue(fontCharacteristics.IsUndefined()); fontCharacteristics.SetBoldFlag(true); NUnit.Framework.Assert.IsTrue(fontCharacteristics.IsBold()); NUnit.Framework.Assert.IsFalse(fontCharacteristics.IsUndefined()); fontCharacteristics = new FontCharacteristics(); fontCharacteristics.SetBoldFlag(false); NUnit.Framework.Assert.IsFalse(fontCharacteristics.IsBold()); NUnit.Framework.Assert.IsTrue(fontCharacteristics.IsUndefined()); }
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 virtual void TestHashCode() { 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.AreEqual(fontCharacteristics.GetHashCode(), sameFontCharacteristics.GetHashCode()); FontCharacteristics copyFontCharacteristics = new FontCharacteristics(fontCharacteristics); NUnit.Framework.Assert.AreEqual(fontCharacteristics.GetHashCode(), copyFontCharacteristics.GetHashCode()); FontCharacteristics diffFontCharacteristics = new FontCharacteristics(); fontCharacteristics.SetBoldFlag(true); fontCharacteristics.SetFontWeight((short)800); NUnit.Framework.Assert.AreNotEqual(fontCharacteristics.GetHashCode(), diffFontCharacteristics.GetHashCode( )); }